From 0ed36154159cf90e2d9ecab6051fe06e8dcaf32f Mon Sep 17 00:00:00 2001 From: Milxnor Date: Tue, 18 Apr 2023 22:21:56 -0400 Subject: [PATCH] a bit add experimental lategame, removed some unnecessary logs --- Project Reboot 3.0/Actor.cpp | 6 + Project Reboot 3.0/Actor.h | 1 + Project Reboot 3.0/BuildingWeapons.cpp | 6 + Project Reboot 3.0/BuildingWeapons.h | 2 + Project Reboot 3.0/FortGameModeAthena.h | 32 ++++ Project Reboot 3.0/FortPlayerController.cpp | 94 ++++++++--- Project Reboot 3.0/FortPlayerController.h | 1 + .../FortPlayerControllerAthena.cpp | 4 +- Project Reboot 3.0/FortPlayerPawnAthena.cpp | 2 +- Project Reboot 3.0/FortPlayerStateAthena.cpp | 5 +- Project Reboot 3.0/GameModeBase.cpp | 23 ++- Project Reboot 3.0/commands.h | 17 ++ Project Reboot 3.0/die.h | 46 +++++- Project Reboot 3.0/dllmain.cpp | 12 +- Project Reboot 3.0/finder.h | 14 +- Project Reboot 3.0/gui.h | 156 ++++++++++++++---- 16 files changed, 336 insertions(+), 85 deletions(-) diff --git a/Project Reboot 3.0/Actor.cpp b/Project Reboot 3.0/Actor.cpp index e919d1b..2f49f70 100644 --- a/Project Reboot 3.0/Actor.cpp +++ b/Project Reboot 3.0/Actor.cpp @@ -37,6 +37,12 @@ FTransform AActor::GetTransform() return Ret; } +void AActor::SetNetDormancy(ENetDormancy Dormancy) +{ + static auto SetNetDormancyFn = FindObject("/Script/Engine.Actor.SetNetDormancy"); + this->ProcessEvent(SetNetDormancyFn, &Dormancy); +} + AActor* AActor::GetOwner() { static auto GetOwnerFunction = FindObject("/Script/Engine.Actor.GetOwner"); diff --git a/Project Reboot 3.0/Actor.h b/Project Reboot 3.0/Actor.h index 019a83b..8da0841 100644 --- a/Project Reboot 3.0/Actor.h +++ b/Project Reboot 3.0/Actor.h @@ -23,6 +23,7 @@ public: bool IsTearOff(); /* FORCEINLINE */ ENetDormancy& GetNetDormancy(); int32& GetNetTag(); + void SetNetDormancy(ENetDormancy Dormancy); AActor* GetOwner(); struct FVector GetActorLocation(); struct FVector GetActorRightVector(); diff --git a/Project Reboot 3.0/BuildingWeapons.cpp b/Project Reboot 3.0/BuildingWeapons.cpp index 48823b1..2c86a43 100644 --- a/Project Reboot 3.0/BuildingWeapons.cpp +++ b/Project Reboot 3.0/BuildingWeapons.cpp @@ -2,6 +2,12 @@ #include "reboot.h" +void AFortWeap_EditingTool::OnRep_EditActor() +{ + static auto OnRep_EditActorFn = FindObject("/Script/FortniteGame.FortWeap_EditingTool.OnRep_EditActor"); + this->ProcessEvent(OnRep_EditActorFn); +} + UClass* AFortWeap_EditingTool::StaticClass() { static auto Class = FindObject(L"/Script/FortniteGame.FortWeap_EditingTool"); diff --git a/Project Reboot 3.0/BuildingWeapons.h b/Project Reboot 3.0/BuildingWeapons.h index 1221f94..c8d5473 100644 --- a/Project Reboot 3.0/BuildingWeapons.h +++ b/Project Reboot 3.0/BuildingWeapons.h @@ -20,5 +20,7 @@ public: return Get(EditActorOffset); } + void OnRep_EditActor(); + static UClass* StaticClass(); }; \ No newline at end of file diff --git a/Project Reboot 3.0/FortGameModeAthena.h b/Project Reboot 3.0/FortGameModeAthena.h index 18a5ef8..cafc14b 100644 --- a/Project Reboot 3.0/FortGameModeAthena.h +++ b/Project Reboot 3.0/FortGameModeAthena.h @@ -24,6 +24,38 @@ enum class EDynamicFoundationType : uint8_t EDynamicFoundationType_MAX = 4 }; +struct FAircraftFlightInfo +{ + float& GetTimeTillDropStart() + { + static auto TimeTillDropStartOffset = FindOffsetStruct("/Script/FortniteGame.AircraftFlightInfo", "TimeTillDropStart"); + return *(float*)(__int64(this) + TimeTillDropStartOffset); + } + + FVector& GetFlightStartLocation() + { + static auto FlightStartLocationOffset = FindOffsetStruct("/Script/FortniteGame.AircraftFlightInfo", "FlightStartLocation"); + return *(FVector*)(__int64(this) + FlightStartLocationOffset); + } + + float& GetFlightSpeed() + { + static auto FlightSpeedOffset = FindOffsetStruct("/Script/FortniteGame.AircraftFlightInfo", "FlightSpeed"); + return *(float*)(__int64(this) + FlightSpeedOffset); + } + + static UStruct* GetStruct() + { + static auto Struct = FindObject("/Script/FortniteGame.AircraftFlightInfo"); + return Struct; + } + + static int GetStructSize() + { + return GetStruct()->GetPropertiesSize(); + } +}; + static void ShowFoundation(UObject* BuildingFoundation) { if (!BuildingFoundation) diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index 2db2eb0..0fed8cc 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -326,6 +326,9 @@ void AFortPlayerController::ServerExecuteInventoryItemHook(AFortPlayerController static auto WallPiece = FindObject("/Game/Items/Weapons/BuildingTools/BuildingItemData_Wall.BuildingItemData_Wall"); static auto StairPiece = FindObject("/Game/Items/Weapons/BuildingTools/BuildingItemData_Stair_W.BuildingItemData_Stair_W"); + UBuildingEditModeMetadata* OldMetadata = nullptr; // Newer versions + OldMetadata = BuildingTool->Get(DefaultMetadataOffset); + if (ItemDefinition == RoofPiece) { static auto RoofMetadata = FindObject("/Game/Building/EditModePatterns/Roof/EMP_Roof_RoofC.EMP_Roof_RoofC"); @@ -347,7 +350,7 @@ void AFortPlayerController::ServerExecuteInventoryItemHook(AFortPlayerController BuildingTool->Get(DefaultMetadataOffset) = FloorMetadata; } - BuildingTool->ProcessEvent(OnRep_DefaultMetadataFn); + BuildingTool->ProcessEvent(OnRep_DefaultMetadataFn, &OldMetadata); } } } @@ -561,15 +564,18 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame* 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()); - auto PlayerController = Cast(Engine_Version < 424 ? PC : ((UActorComponent*)PC)->GetOwner()); + if (Engine_Version < 424 && !Globals::bLateGame) + return ServerAttemptAircraftJumpOriginal(PC, ClientRotation); + + if (Fortnite_Version == 17.30 && Globals::bGoingToPlayEvent) + return ServerAttemptAircraftJumpOriginal(PC, ClientRotation); // We want to be teleported back to the UFO but we dont use chooseplayerstart LOG_INFO(LogDev, "PlayerController: {}", __int64(PlayerController)); if (!PlayerController) - return; + return ServerAttemptAircraftJumpOriginal(PC, ClientRotation); // if (!PlayerController->bInAircraft) // return; @@ -581,7 +587,7 @@ void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController* auto Aircrafts = GameState->GetPtr>(AircraftsOffset); if (Aircrafts->Num() <= 0) - return; + return ServerAttemptAircraftJumpOriginal(PC, ClientRotation); auto NewPawn = GameMode->SpawnDefaultPawnForHook(GameMode, (AController*)PlayerController, Aircrafts->at(0)); PlayerController->Possess(NewPawn); @@ -592,6 +598,43 @@ void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController* NewPawnAsFort->SetHealth(100); // PlayerController->ServerRestartPlayer(); + + if (Globals::bLateGame) + { + static auto WoodItemData = FindObject("/Game/Items/ResourcePickups/WoodItemData.WoodItemData"); + static auto StoneItemData = FindObject("/Game/Items/ResourcePickups/StoneItemData.StoneItemData"); + static auto MetalItemData = FindObject("/Game/Items/ResourcePickups/MetalItemData.MetalItemData"); + + static auto Rifle = FindObject("/Game/Athena/Items/Weapons/WID_Assault_AutoHigh_Athena_SR_Ore_T03.WID_Assault_AutoHigh_Athena_SR_Ore_T03"); + static auto Shotgun = FindObject("/Game/Athena/Items/Weapons/WID_Shotgun_Standard_Athena_SR_Ore_T03.WID_Shotgun_Standard_Athena_SR_Ore_T03"); + static auto SMG = FindObject("/Game/Athena/Items/Weapons/WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03.WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03"); + + static auto MiniShields = FindObject("/Game/Athena/Items/Consumables/ShieldSmall/Athena_ShieldSmall.Athena_ShieldSmall"); + + static auto Shells = FindObject("/Game/Athena/Items/Ammo/AthenaAmmoDataShells.AthenaAmmoDataShells"); + static auto Medium = FindObject("/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsMedium.AthenaAmmoDataBulletsMedium"); + static auto Light = FindObject("/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsLight.AthenaAmmoDataBulletsLight"); + static auto Heavy = FindObject("/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsHeavy.AthenaAmmoDataBulletsHeavy"); + + auto WorldInventory = PlayerController->GetWorldInventory(); + + if (!WorldInventory) + return ServerAttemptAircraftJumpOriginal(PC, ClientRotation); + + WorldInventory->AddItem(WoodItemData, nullptr, 500); + WorldInventory->AddItem(StoneItemData, nullptr, 500); + WorldInventory->AddItem(MetalItemData, nullptr, 500); + WorldInventory->AddItem(Rifle, nullptr, 1); + WorldInventory->AddItem(Shotgun, nullptr, 1); + WorldInventory->AddItem(SMG, nullptr, 1); + WorldInventory->AddItem(MiniShields, nullptr, 6); + WorldInventory->AddItem(Shells, nullptr, 999); + WorldInventory->AddItem(Medium, nullptr, 999); + WorldInventory->AddItem(Light, nullptr, 999); + WorldInventory->AddItem(Heavy, nullptr, 999); + + WorldInventory->Update(); + } } void AFortPlayerController::ServerDropAllItemsHook(AFortPlayerController* PlayerController, UFortItemDefinition* IgnoreItemDef) @@ -1217,42 +1260,42 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToEdit) { - // LOG_INFO(LogDev, "ServerBeginEditingBuildingActorHook!"); - - if (!BuildingActorToEdit || !BuildingActorToEdit->IsPlayerPlaced()) + if (!BuildingActorToEdit || !BuildingActorToEdit->IsPlayerPlaced()) // We need more checks. return; auto Pawn = PlayerController->GetMyFortPawn(); - // LOG_INFO(LogDev, "ServerBeginEditingBuildingAc1341torHook!"); - if (!Pawn) return; - // LOG_INFO(LogDev, "ServerBeginEditingBuildingActorHook134!"); + auto PlayerState = PlayerController->GetPlayerState(); - static auto EditToolDef = FindObject("/Game/Items/Weapons/BuildingTools/EditTool.EditTool"); + if (!PlayerState) + return; - /* auto WorldInventory = PlayerController->GetWorldInventory(); + // if (!BuildingActorToEdit->GetEditingPlayer() || !PlayerController->GetPlayerState()) + // SetNetDormancy(BuildingActorToEdit, 1); + BuildingActorToEdit->SetNetDormancy(ENetDormancy::DORM_Awake); + BuildingActorToEdit->GetEditingPlayer() = PlayerState; + // Onrep? + + auto WorldInventory = PlayerController->GetWorldInventory(); if (!WorldInventory) return; + static auto EditToolDef = FindObject("/Game/Items/Weapons/BuildingTools/EditTool.EditTool"); + auto EditToolInstance = WorldInventory->FindItemInstance(EditToolDef); if (!EditToolInstance) return; - if (auto EditTool = Cast(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid()))) */ - if (auto EditTool = Cast(Pawn->EquipWeaponDefinition(EditToolDef, FGuid{}))) + if (auto EditTool = Cast(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid()))) + // if (auto EditTool = Cast(Pawn->EquipWeaponDefinition(EditToolDef, FGuid{}))) { - // LOG_INFO(LogDev, "ServerBeginEditingBuild135415ingActorHook!"); - - BuildingActorToEdit->GetEditingPlayer() = PlayerController->GetPlayerState(); - // Onrep? - EditTool->GetEditActor() = BuildingActorToEdit; - // Onrep? + EditTool->OnRep_EditActor(); } else { @@ -1299,11 +1342,10 @@ void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame BuildingActorToEdit->GetCurrentBuildingLevel(), RotationIterations, bMirrored, PlayerController)) { BuildingActor->SetPlayerPlaced(true); - - // if (auto PlayerState = Cast(PlayerController->GetPlayerState())) - // BuildingActor->SetTeam(PlayerState->GetTeamIndex()); } + // we should do more things here + return ServerEditBuildingActorOriginal(Context, Stack, Ret); } @@ -1324,6 +1366,6 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl if (EditTool) { EditTool->GetEditActor() = nullptr; - // EditTool->OnRep_EditActor(); + EditTool->OnRep_EditActor(); } } \ No newline at end of file diff --git a/Project Reboot 3.0/FortPlayerController.h b/Project Reboot 3.0/FortPlayerController.h index f4d4f87..1a995a4 100644 --- a/Project Reboot 3.0/FortPlayerController.h +++ b/Project Reboot 3.0/FortPlayerController.h @@ -50,6 +50,7 @@ public: static inline void (*DropSpecificItemOriginal)(UObject* Context, FFrame& Stack, void* Ret); static inline AActor* (*SpawnToyInstanceOriginal)(UObject* Context, FFrame* Stack, AActor** Ret); static inline void (*ServerLoadingScreenDroppedOriginal)(UObject* Context, FFrame* Stack, void* Ret); + static inline void (*ServerAttemptAircraftJumpOriginal)(AFortPlayerController* PC, FRotator ClientRotation); void ClientReportDamagedResourceBuilding(ABuildingSMActor* BuildingSMActor, EFortResourceType PotentialResourceType, int PotentialResourceCount, bool bDestroyed, bool bJustHitWeakspot); diff --git a/Project Reboot 3.0/FortPlayerControllerAthena.cpp b/Project Reboot 3.0/FortPlayerControllerAthena.cpp index 821c307..3739049 100644 --- a/Project Reboot 3.0/FortPlayerControllerAthena.cpp +++ b/Project Reboot 3.0/FortPlayerControllerAthena.cpp @@ -49,7 +49,7 @@ void AFortPlayerControllerAthena::ServerRequestSeatChangeHook(AFortPlayerControl auto PickaxeInstance = WorldInventory->GetPickaxeInstance(); if (!PickaxeInstance) - return; + return ServerRequestSeatChangeOriginal(PlayerController, TargetSeatIndex); AFortPlayerController::ServerExecuteInventoryItemHook(PlayerController, PickaxeInstance->GetItemEntry()->GetItemGuid()); // Bad, we should equip the last weapon. return ServerRequestSeatChangeOriginal(PlayerController, TargetSeatIndex); @@ -59,7 +59,7 @@ void AFortPlayerControllerAthena::ServerRequestSeatChangeHook(AFortPlayerControl auto RequestedVehicleInstance = NewAndModifiedInstances.first[0]; if (!RequestedVehicleInstance) - return; + return ServerRequestSeatChangeOriginal(PlayerController, TargetSeatIndex); WorldInventory->Update(); diff --git a/Project Reboot 3.0/FortPlayerPawnAthena.cpp b/Project Reboot 3.0/FortPlayerPawnAthena.cpp index 250e1b3..097bfa1 100644 --- a/Project Reboot 3.0/FortPlayerPawnAthena.cpp +++ b/Project Reboot 3.0/FortPlayerPawnAthena.cpp @@ -14,7 +14,7 @@ void AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook(UObject* Context, FFrame* bool bFromSweep; auto SweepResultPtr = (FHitResult*)std::realloc(0, FHitResult::GetStructSize()); - LOG_INFO(LogDev, "OnCapsuleBeginOverlapHook!"); + // LOG_INFO(LogDev, "OnCapsuleBeginOverlapHook!"); Stack->StepCompiledIn(&OverlappedComp); Stack->StepCompiledIn(&OtherActor); diff --git a/Project Reboot 3.0/FortPlayerStateAthena.cpp b/Project Reboot 3.0/FortPlayerStateAthena.cpp index e6cd407..f8b441b 100644 --- a/Project Reboot 3.0/FortPlayerStateAthena.cpp +++ b/Project Reboot 3.0/FortPlayerStateAthena.cpp @@ -4,11 +4,14 @@ void AFortPlayerStateAthena::ServerSetInAircraftHook(UObject* Context, FFrame& Stack, void* Ret) { + if (Globals::bLateGame) + return ServerSetInAircraftOriginal(Context, Stack, Ret); + auto PlayerState = (AFortPlayerStateAthena*)Context; auto PlayerController = Cast(PlayerState->GetOwner()); if (!PlayerController) - return; + return ServerSetInAircraftOriginal(Context, Stack, Ret); // std::cout << "bNewInAircraft: " << bNewInAircraft << '\n'; // std::cout << "PlayerController->IsInAircraft(): " << PlayerController->IsInAircraft() << '\n'; diff --git a/Project Reboot 3.0/GameModeBase.cpp b/Project Reboot 3.0/GameModeBase.cpp index 48225a8..0d95c0b 100644 --- a/Project Reboot 3.0/GameModeBase.cpp +++ b/Project Reboot 3.0/GameModeBase.cpp @@ -3,6 +3,7 @@ #include "reboot.h" #include "FortPlayerControllerAthena.h" #include "FortGameModeAthena.h" +#include "FortLootPackage.h" UClass* AGameModeBase::GetDefaultPawnClassForController(AController* InController) { @@ -81,6 +82,9 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll { auto WorldInventory = NewPlayerAsAthena->GetWorldInventory(); + if (!WorldInventory) + return NewPawn; + if (!WorldInventory->GetPickaxeInstance()) { auto CosmeticLoadout = NewPlayerAsAthena->GetCosmeticLoadout(); @@ -101,18 +105,33 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll static UFortItemDefinition* WoodItemData = FindObject(L"/Game/Items/ResourcePickups/WoodItemData.WoodItemData"); static UFortItemDefinition* DamageTrap = FindObject(L"/Game/Athena/Items/Traps/TID_ContextTrap_Athena.TID_ContextTrap_Athena"); + WorldInventory->AddItem(PickaxeDefinition, nullptr); WorldInventory->AddItem(EditToolItemDefinition, nullptr); WorldInventory->AddItem(BuildingItemData_Wall, nullptr); WorldInventory->AddItem(BuildingItemData_Floor, nullptr); WorldInventory->AddItem(BuildingItemData_Stair_W, nullptr); WorldInventory->AddItem(BuildingItemData_RoofS, nullptr); - WorldInventory->AddItem(PickaxeDefinition, nullptr); // WorldInventory->AddItem(WoodItemData, nullptr, 100); // WorldInventory->AddItem(DamageTrap, nullptr); // WorldInventory->AddItem(FindObject(L"/ParallelGameplay/Items/WestSausage/WID_WestSausage_Parallel.WID_WestSausage_Parallel"), nullptr, 1, 1000); // WorldInventory->AddItem(FindObject(L"/Game/Athena/Items/Consumables/HappyGhost/WID_Athena_HappyGhost.WID_Athena_HappyGhost"), nullptr); - WorldInventory->Update(true); + /* if (Globals::bLateGame) + { + auto SpawnIslandTierGroup = UKismetStringLibrary::Conv_StringToName(L"Loot_AthenaFloorLoot_Warmup"); + + for (int i = 0; i < 5; i++) + { + auto LootDrops = PickLootDrops(SpawnIslandTierGroup); + + for (auto& LootDrop : LootDrops) + { + WorldInventory->AddItem(LootDrop.ItemDefinition, nullptr, LootDrop.Count, LootDrop.LoadedAmmo); + } + } + } */ + + WorldInventory->Update(); } } } diff --git a/Project Reboot 3.0/commands.h b/Project Reboot 3.0/commands.h index 307f502..21f6b3c 100644 --- a/Project Reboot 3.0/commands.h +++ b/Project Reboot 3.0/commands.h @@ -448,6 +448,23 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg) CheatManager->Teleport(); CheatManager = nullptr; } + else if (Command == "setsafezonephase") + { + int NewSafeZonePhase = 1; + + try { NewSafeZonePhase = std::stof(Arguments[1]); } + catch (...) {} + + auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode(); + auto GameState = GameMode->GetGameState(); + + static auto GameMode_SafeZonePhaseOffset = GameMode->GetOffset("SafeZonePhase"); + static auto GameState_SafeZonePhaseOffset = GameState->GetOffset("SafeZonePhase"); + + GameMode->Get(GameMode_SafeZonePhaseOffset) = NewSafeZonePhase; + GameState->Get(GameState_SafeZonePhaseOffset) = NewSafeZonePhase; + SendMessageToConsole(PlayerController, L"Set safe zone phase!"); + } else if (Command == "bugitgo") { if (Arguments.size() <= 3) diff --git a/Project Reboot 3.0/die.h b/Project Reboot 3.0/die.h index eac9365..945b43e 100644 --- a/Project Reboot 3.0/die.h +++ b/Project Reboot 3.0/die.h @@ -12,10 +12,51 @@ static inline void (*SetZoneToIndexOriginal)(AFortGameModeAthena* GameModeAthena static void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int OverridePhaseMaybeIDFK) { + static auto ZoneDurationsOffset = Fortnite_Version >= 15 && Fortnite_Version < 18 ? 0x258 + : std::floor(Fortnite_Version) >= 18 ? 0x248 + : 0x1F8; // S13-S14 + + LOG_INFO(LogDev, "SetZoneToIndexHook!"); + + bool bIsFirstZone = false; + auto GameState = Cast(GameModeAthena->GetGameState()); - if (!GameState) + if (Globals::bLateGame) + { + static auto GameMode_SafeZonePhaseOffset = GameModeAthena->GetOffset("SafeZonePhase"); + static auto GameState_SafeZonePhaseOffset = GameState->GetOffset("SafeZonePhase"); + + int NewSafeZonePhase = GameModeAthena->Get(GameMode_SafeZonePhaseOffset); + + if (NewSafeZonePhase < 4) + { + NewSafeZonePhase = 4; + bIsFirstZone = true; + } + + LOG_INFO(LogDev, "Setting zone to: {}", NewSafeZonePhase); + + GameModeAthena->Get(GameMode_SafeZonePhaseOffset) = NewSafeZonePhase; + GameState->Get(GameState_SafeZonePhaseOffset) = NewSafeZonePhase; + } + + if (Fortnite_Version < 13) + { + SetZoneToIndexOriginal(GameModeAthena, OverridePhaseMaybeIDFK); + + if (Globals::bLateGame && bIsFirstZone) + { + // UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"skipshrinksafezone", nullptr); + // UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr); + // UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"skipshrinksafezone", nullptr); + } + return; + } + + if (!GameState) + return SetZoneToIndexOriginal(GameModeAthena, OverridePhaseMaybeIDFK); static auto SafeZoneIndicatorOffset = GameModeAthena->GetOffset("SafeZoneIndicator"); auto SafeZoneIndicator = GameModeAthena->Get(SafeZoneIndicatorOffset); @@ -34,8 +75,7 @@ static void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int Override LOG_INFO(LogDev, "SafeZoneDefinitionOffset: 0x{:x}", SafeZoneDefinitionOffset); - static auto ZoneDurationsOffset = Fortnite_Version >= 15 && Fortnite_Version < 18 ? 0x258 : std::floor(Fortnite_Version) >= 18 ? 0x248 : 0x1F8; - static auto ZoneHoldDurationsOffset = ZoneDurationsOffset - 0x10; + static auto ZoneHoldDurationsOffset = ZoneDurationsOffset - 0x10; // fr auto& ZoneDurations = *(TArray*)(__int64(SafeZoneDefinition) + ZoneDurationsOffset); auto& ZoneHoldDurations = *(TArray*)(__int64(SafeZoneDefinition) + ZoneHoldDurationsOffset); diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index 9acb005..fc271d1 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -622,11 +622,13 @@ DWORD WINAPI Main(LPVOID) VirtualSwap(FortAbilitySystemComponentAthenaDefault->VFTable, InternalServerTryActivateAbilityIndex, UAbilitySystemComponent::InternalServerTryActivateAbilityHook); } - if (Engine_Version >= 424) + // if (Engine_Version >= 424) { - static auto FortControllerComponent_AircraftDefault = FindObject(L"/Script/FortniteGame.Default__FortControllerComponent_Aircraft"); + static auto FortControllerComponent_AircraftDefault = FindObject(L"/Script/FortniteGame.Default__FortControllerComponent_Aircraft"); + static auto ServerAttemptAircraftJumpFn = FindObject(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerAttemptAircraftJump") ? FindObject(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerAttemptAircraftJump") + : FindObject(L"/Script/FortniteGame.FortControllerComponent_Aircraft.ServerAttemptAircraftJump"); - Hooking::MinHook::Hook(FortControllerComponent_AircraftDefault, FindObject(L"/Script/FortniteGame.FortControllerComponent_Aircraft.ServerAttemptAircraftJump"), + Hooking::MinHook::Hook(FortControllerComponent_AircraftDefault ? FortControllerComponent_AircraftDefault : FortPlayerControllerAthenaDefault, ServerAttemptAircraftJumpFn, AFortPlayerController::ServerAttemptAircraftJumpHook, nullptr, false); } @@ -683,8 +685,8 @@ DWORD WINAPI Main(LPVOID) ); } - if (Fortnite_Version >= 13) - Hooking::MinHook::Hook((PVOID)Addresses::SetZoneToIndex, (PVOID)SetZoneToIndexHook, (PVOID*)&SetZoneToIndexOriginal); + // if (Fortnite_Version >= 13) + Hooking::MinHook::Hook((PVOID)Addresses::SetZoneToIndex, (PVOID)SetZoneToIndexHook, (PVOID*)&SetZoneToIndexOriginal); #ifndef PROD Hooking::MinHook::Hook((PVOID)Addresses::ProcessEvent, ProcessEventHook, (PVOID*)&UObject::ProcessEventOriginal); diff --git a/Project Reboot 3.0/finder.h b/Project Reboot 3.0/finder.h index 0ebb4e7..7d392b0 100644 --- a/Project Reboot 3.0/finder.h +++ b/Project Reboot 3.0/finder.h @@ -623,16 +623,10 @@ static inline uint64 FindNoMCP() static inline uint64 FindSetZoneToIndex() // actually StartNewSafeZonePhase { - // return 0; - - // if (Fortnite_Version == 14.60) - // return __int64(GetModuleHandleW(0)) + 0x207F9B0; - - // return Memcury::Scanner::FindPattern("48 8B C4 48 89 58 10 48 89 70 18 48 89 78 20 55 41 54 41 55 41 56 41 57 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 0F 29 70 C8 0F 29 78 B8 44 0F 29 40 ? 44 0F 29 48 ? 44 0F 29 50 ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 44 8B F2 89 54 24 48 4C 8B F9 48 89 4D 90 E8 ? ? ? ? 45 33 ED 48 89 45 A0 48 8B F0").Get(); // 19.10 - // return Memcury::Scanner::FindPattern("48 8B C4 48 89 58 10 48 89 70 18 48 89 78 20 55 41 54 41 55 41 56 41 57 48 8D 68 98 48 81 EC ? ? ? ? 0F 29 70 C8 0F 29 78 B8 44 0F 29 40 ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 45 08 44 8B F2 89 54 24 48 48 8B F1 48 89 4C 24 ? E8 ? ? ? ? 45 33 E4 48 89 44 24 ? 4C 8B F8 48 85 C0 74 09").Get(); // 17.30 - // return Memcury::Scanner::FindPattern("48 8B C4 48 89 58 10 48 89 70 18 48 89 78 20 55 41 54 41 55 41 56 41 57 48 8D 68 88 48 81 EC ? ? ? ? 0F 29 70 C8 0F 29 78 B8 44 0F 29 40 ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 45 10 44 8B F2 89 54 24 48 48 8B F1 48 89 4C 24 ? E8 ? ? ? ? 45 33 E4 48 89 45 80 4C 8B F8 48 85 C0 74 09 48 8B B8").Get(); // 17.50 - // return Memcury::Scanner::FindPattern("48 8B C4 48 89 58 10 48 89 70 18 48 89 78 20 55 41 54 41 55 41 56 41 57 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 0F 29 70 C8 0F 29 78 B8 44 0F 29 40 ? 44 0F 29 48 ? 44 0F 29 50 ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 4C 8B B1 ? ? ? ? 45 33 ED 89 54 24 70 44 8B FA 48 89 4C 24").Get(); // 18.40 - // return Memcury::Scanner::FindPattern("40 55 53 56 41 55 48 8D 6C 24 ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 45 18 48 8B").Get(); // 14.60 + if (Engine_Version == 420) + return Memcury::Scanner::FindPattern("E8 ? ? ? ? EB 31 80 B9 ? ? ? ? ?").RelativeOffset(1).Get(); // 3.5 + if (Engine_Version == 422) + return Memcury::Scanner::FindPattern("E9 ? ? ? ? 48 8B C1 40 38 B9").RelativeOffset(1).Get(); // 7.40 auto Addr = Memcury::Scanner::FindStringRef(L"FortGameModeAthena: No MegaStorm on SafeZone[%d]. GridCellThickness is less than 1.0.", true, 0, Fortnite_Version >= 16.50).Get(); // return FindBytes(Addr, { 0x40, 0x55 }, 30000, 0, true); diff --git a/Project Reboot 3.0/gui.h b/Project Reboot 3.0/gui.h index 57d6a61..222dd82 100644 --- a/Project Reboot 3.0/gui.h +++ b/Project Reboot 3.0/gui.h @@ -420,59 +420,145 @@ void MainUI() } } - if (ImGui::Button("Start Bus Countdown")) + if (Globals::bLateGame) { - auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode(); - auto GameState = GameMode->GetGameState(); - - if (Fortnite_Version == 1.11) + if (ImGui::Button("Start Bus")) { - static auto OverrideBattleBusSkin = FindObject("/Game/Athena/Items/Cosmetics/BattleBuses/BBID_WinterBus.BBID_WinterBus"); - LOG_INFO(LogDev, "OverrideBattleBusSkin: {}", __int64(OverrideBattleBusSkin)); + auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode(); + auto GameState = GameMode->GetGameState(); - if (OverrideBattleBusSkin) + static auto AircraftsOffset = GameState->GetOffset("Aircrafts"); + + UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startaircraft", nullptr); + + while (GameState->GetPtr>(AircraftsOffset)->Num() <= 0) // hmm { - static auto AssetManagerOffset = GetEngine()->GetOffset("AssetManager"); - auto AssetManager = GetEngine()->Get(AssetManagerOffset); + Sleep(500); + } - if (AssetManager) + UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startsafezone", nullptr); + + static auto SafeZoneLocationsOffset = GameMode->GetOffset("SafeZoneLocations"); + auto& SafeZoneLocations = GameMode->Get>(SafeZoneLocationsOffset); + + LOG_INFO(LogDev, "SafeZoneLocations.Num(): {}", SafeZoneLocations.Num()); + + static auto SafeZoneIndicatorOffset = GameState->GetOffset("SafeZoneIndicator"); + + static auto SafeZonesStartTimeOffset = GameState->GetOffset("SafeZonesStartTime"); + GameState->Get(SafeZonesStartTimeOffset) = 0; + + while (!GameState->Get(SafeZoneIndicatorOffset)) + { + Sleep(500); + } + + auto Aircrafts = GameState->GetPtr>(AircraftsOffset); + + while (Aircrafts->Num() <= 0) + { + Sleep(500); + } + + static auto NextCenterOffset = GameState->Get(SafeZoneIndicatorOffset)->GetOffset("NextCenter"); + FVector LocationToStartAircraft = GameState->Get(SafeZoneIndicatorOffset)->Get(NextCenterOffset); // SafeZoneLocations.at(4); + LocationToStartAircraft.Z += 10000; + + for (int i = 0; i < Aircrafts->Num(); i++) + { + Aircrafts->at(i)->TeleportTo(LocationToStartAircraft, FRotator()); + + static auto FlightInfoOffset = Aircrafts->at(i)->GetOffset("FlightInfo"); + auto FlightInfo = Aircrafts->at(i)->GetPtr(FlightInfoOffset); + + FlightInfo->GetFlightSpeed() = 0; + FlightInfo->GetFlightStartLocation() = LocationToStartAircraft; + FlightInfo->GetTimeTillDropStart() = 0.0f; + } + + static auto MapInfoOffset = GameState->GetOffset("MapInfo"); + auto MapInfo = GameState->Get(MapInfoOffset); + + if (MapInfo) + { + static auto FlightInfosOffset = MapInfo->GetOffset("FlightInfos"); + auto& FlightInfos = MapInfo->Get>(FlightInfosOffset); + + LOG_INFO(LogDev, "FlightInfos.Num(): {}", FlightInfos.Num()); + + for (int i = 0; i < FlightInfos.Num(); i++) { - static auto AthenaGameDataOffset = AssetManager->GetOffset("AthenaGameData"); - auto AthenaGameData = AssetManager->Get(AthenaGameDataOffset); + auto FlightInfo = FlightInfos.AtPtr(i, FAircraftFlightInfo::GetStructSize()); - if (AthenaGameData) - { - static auto DefaultBattleBusSkinOffset = AthenaGameData->GetOffset("DefaultBattleBusSkin"); - AthenaGameData->Get(DefaultBattleBusSkinOffset) = OverrideBattleBusSkin; - } + FlightInfo->GetFlightSpeed() = 0; + FlightInfo->GetFlightStartLocation() = LocationToStartAircraft; + FlightInfo->GetTimeTillDropStart() = 0.0f; } + } - static auto DefaultBattleBusOffset = GameState->GetOffset("DefaultBattleBus"); - GameState->Get(DefaultBattleBusOffset) = OverrideBattleBusSkin; + static auto bAircraftIsLockedOffset = GameState->GetOffset("bAircraftIsLocked"); + static auto bAircraftIsLockedFieldMask = GetFieldMask(GameState->GetProperty("bAircraftIsLocked")); + GameState->SetBitfieldValue(bAircraftIsLockedOffset, bAircraftIsLockedFieldMask, false); - static auto FortAthenaAircraftClass = FindObject("/Script/FortniteGame.FortAthenaAircraft"); - auto AllAircrafts = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortAthenaAircraftClass); + UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"skipshrinksafezone", nullptr); + } + } + else + { + if (ImGui::Button("Start Bus Countdown")) + { + auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode(); + auto GameState = GameMode->GetGameState(); - for (int i = 0; i < AllAircrafts.Num(); i++) + if (Fortnite_Version == 1.11) + { + static auto OverrideBattleBusSkin = FindObject("/Game/Athena/Items/Cosmetics/BattleBuses/BBID_WinterBus.BBID_WinterBus"); + LOG_INFO(LogDev, "OverrideBattleBusSkin: {}", __int64(OverrideBattleBusSkin)); + + if (OverrideBattleBusSkin) { - auto Aircraft = AllAircrafts.at(i); + static auto AssetManagerOffset = GetEngine()->GetOffset("AssetManager"); + auto AssetManager = GetEngine()->Get(AssetManagerOffset); - static auto DefaultBusSkinOffset = Aircraft->GetOffset("DefaultBusSkin"); - Aircraft->Get(DefaultBusSkinOffset) = OverrideBattleBusSkin; - - static auto SpawnedCosmeticActorOffset = Aircraft->GetOffset("SpawnedCosmeticActor"); - auto SpawnedCosmeticActor = Aircraft->Get(SpawnedCosmeticActorOffset); - - if (SpawnedCosmeticActor) + if (AssetManager) { - static auto ActiveSkinOffset = SpawnedCosmeticActor->GetOffset("ActiveSkin"); - SpawnedCosmeticActor->Get(ActiveSkinOffset) = OverrideBattleBusSkin; + static auto AthenaGameDataOffset = AssetManager->GetOffset("AthenaGameData"); + auto AthenaGameData = AssetManager->Get(AthenaGameDataOffset); + + if (AthenaGameData) + { + static auto DefaultBattleBusSkinOffset = AthenaGameData->GetOffset("DefaultBattleBusSkin"); + AthenaGameData->Get(DefaultBattleBusSkinOffset) = OverrideBattleBusSkin; + } + } + + static auto DefaultBattleBusOffset = GameState->GetOffset("DefaultBattleBus"); + GameState->Get(DefaultBattleBusOffset) = OverrideBattleBusSkin; + + static auto FortAthenaAircraftClass = FindObject("/Script/FortniteGame.FortAthenaAircraft"); + auto AllAircrafts = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortAthenaAircraftClass); + + for (int i = 0; i < AllAircrafts.Num(); i++) + { + auto Aircraft = AllAircrafts.at(i); + + static auto DefaultBusSkinOffset = Aircraft->GetOffset("DefaultBusSkin"); + Aircraft->Get(DefaultBusSkinOffset) = OverrideBattleBusSkin; + + static auto SpawnedCosmeticActorOffset = Aircraft->GetOffset("SpawnedCosmeticActor"); + auto SpawnedCosmeticActor = Aircraft->Get(SpawnedCosmeticActorOffset); + + if (SpawnedCosmeticActor) + { + static auto ActiveSkinOffset = SpawnedCosmeticActor->GetOffset("ActiveSkin"); + SpawnedCosmeticActor->Get(ActiveSkinOffset) = OverrideBattleBusSkin; + } } } } - } - GameState->Get("WarmupCountdownEndTime") = UGameplayStatics::GetTimeSeconds(GetWorld()) + 10; + GameState->Get("WarmupCountdownEndTime") = UGameplayStatics::GetTimeSeconds(GetWorld()) + 10; + } } } }