From d53626a850ade19d779765cbcca7b4d4309d3ab5 Mon Sep 17 00:00:00 2001 From: Milxnor Date: Fri, 31 Mar 2023 18:06:36 -0400 Subject: [PATCH] a lot change how abilities work ("more" proper), readded vehicle spawning to s8-s12, fixed respawning on >s4, added a count check to looting so it can't drop 0 count, added zipline jumping, guarantee pawn spawn, clear inventory on aircraft --- Project Reboot 3.0/AbilitySystemComponent.h | 7 +-- .../AbilitySystemComponent_Abilities.cpp | 38 +----------- .../BuildingGameplayActorSpawnMachine.h | 2 + Project Reboot 3.0/FortAthenaSupplyDrop.h | 2 +- Project Reboot 3.0/FortGameModeAthena.cpp | 21 ++----- Project Reboot 3.0/FortGameStateAthena.cpp | 52 ++++++++++++++++ Project Reboot 3.0/FortLootPackage.cpp | 4 +- Project Reboot 3.0/FortPlayerController.cpp | 2 +- Project Reboot 3.0/FortPlayerPawn.cpp | 47 ++++++++++++++- Project Reboot 3.0/FortPlayerPawn.h | 1 + Project Reboot 3.0/FortPlayerStateAthena.cpp | 58 ++++++++++++++++++ Project Reboot 3.0/FortPlayerStateAthena.h | 5 ++ Project Reboot 3.0/GameModeBase.cpp | 22 +++++-- Project Reboot 3.0/Project Reboot 3.0.vcxproj | 2 + .../Project Reboot 3.0.vcxproj.filters | 6 ++ Project Reboot 3.0/SoftObjectPtr.h | 7 ++- Project Reboot 3.0/World.cpp | 2 +- Project Reboot 3.0/dllmain.cpp | 37 ++++++++---- Project Reboot 3.0/finder.h | 2 +- Project Reboot 3.0/globals.h | 2 +- Project Reboot 3.0/hooking.h | 60 ++++++++++--------- Project Reboot 3.0/vehicles.h | 7 ++- 22 files changed, 269 insertions(+), 117 deletions(-) create mode 100644 Project Reboot 3.0/BuildingGameplayActorSpawnMachine.h create mode 100644 Project Reboot 3.0/FortPlayerStateAthena.cpp diff --git a/Project Reboot 3.0/AbilitySystemComponent.h b/Project Reboot 3.0/AbilitySystemComponent.h index 6247d81..2ec24cb 100644 --- a/Project Reboot 3.0/AbilitySystemComponent.h +++ b/Project Reboot 3.0/AbilitySystemComponent.h @@ -35,10 +35,5 @@ public: FGameplayAbilitySpecHandle GiveAbilityEasy(UClass* AbilityClass); FGameplayAbilitySpec* FindAbilitySpecFromHandle(FGameplayAbilitySpecHandle Handle); - static void ServerTryActivateAbilityHook1(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, PadHex10 PredictionKey); - static void ServerTryActivateAbilityHook2(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, PadHex18 PredictionKey); - static void ServerTryActivateAbilityWithEventDataHook1(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, PadHex10 PredictionKey, FGameplayEventData TriggerEventData); - static void ServerTryActivateAbilityWithEventDataHook2(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, PadHex18 PredictionKey, FGameplayEventData TriggerEventData); - - static void ServerAbilityRPCBatchHook(UAbilitySystemComponent* AbilitySystemComponent, __int64 BatchInfo); + static void InternalServerTryActivateAbilityHook(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, const FPredictionKey* PredictionKey, const FGameplayEventData* TriggerEventData); }; \ No newline at end of file diff --git a/Project Reboot 3.0/AbilitySystemComponent_Abilities.cpp b/Project Reboot 3.0/AbilitySystemComponent_Abilities.cpp index dcdbd2f..b30bd91 100644 --- a/Project Reboot 3.0/AbilitySystemComponent_Abilities.cpp +++ b/Project Reboot 3.0/AbilitySystemComponent_Abilities.cpp @@ -25,8 +25,7 @@ void LoopSpecs(UAbilitySystemComponent* AbilitySystemComponent, std::function= 423 && Engine_Version < 426) // 423+ we need to spawn manually and vehicle sync doesn't work on >S13. { - bSpawnedVehicles = true; + static int LastNum420 = 1; - /* static auto GalileoSpawnerClass = FindObject("/Game/Athena/AI/Galileo/BP_Galileo_Spawner.BP_Galileo_Spawner_C"); - auto GalileoSpawners = UGameplayStatics::GetAllActorsOfClass(GetWorld(), GalileoSpawnerClass); - - LOG_INFO(LogDev, "GalileoSpawners.Num(): {}", GalileoSpawners.Num()); - - for (int i = 0; i < GalileoSpawners.Num(); i++) + if (AmountOfRestarts != LastNum420) { - auto GalileoSpawner = GalileoSpawners.at(i); + LastNum420 = AmountOfRestarts; - auto NewPawn = SpawnAIFromCustomizationData(GalileoSpawner->GetActorLocation(), GalileoSpawner->Get("BotData")); - } */ - - // SpawnVehicles(); + SpawnVehicles2(); + } } auto NewPlayer = (AFortPlayerControllerAthena*)NewPlayerActor; diff --git a/Project Reboot 3.0/FortGameStateAthena.cpp b/Project Reboot 3.0/FortGameStateAthena.cpp index b4dbfce..b1ad031 100644 --- a/Project Reboot 3.0/FortGameStateAthena.cpp +++ b/Project Reboot 3.0/FortGameStateAthena.cpp @@ -2,6 +2,7 @@ #include "reboot.h" #include "FortPlayerStateAthena.h" +#include "FortGameModeAthena.h" /* void AFortGameStateAthena::AddPlayerStateToGameMemberInfo(class AFortPlayerStateAthena* PlayerState) { @@ -54,10 +55,61 @@ int AFortGameStateAthena::GetAircraftIndex(AFortPlayerState* PlayerState) bool AFortGameStateAthena::IsRespawningAllowed(AFortPlayerState* PlayerState) // actually in zone { + auto GameModeAthena = Cast(GetWorld()->GetGameMode()); static auto IsRespawningAllowedFn = FindObject("/Script/FortniteGame.FortGameStateZone.IsRespawningAllowed"); + LOG_INFO(LogDev, "IsRespawningAllowedFn: {}", __int64(IsRespawningAllowedFn)); + if (!IsRespawningAllowedFn) + { + auto CurrentPlaylist = GetCurrentPlaylist(); + + if (!CurrentPlaylist) + return false; + + static auto RespawnTypeOffset = CurrentPlaylist->GetOffset("RespawnType"); + + if (RespawnTypeOffset == -1) + return false; + + auto& RespawnType = CurrentPlaylist->Get(RespawnTypeOffset); + LOG_INFO(LogDev, "RespawnType: {}", (int)RespawnType); + + if (RespawnType == 1) + return true; + + if (RespawnType == 2) // InfiniteRespawnExceptStorm + { + static auto SafeZoneIndicatorOffset = GameModeAthena->GetOffset("SafeZoneIndicator"); + auto SafeZoneIndicator = GameModeAthena->Get(SafeZoneIndicatorOffset); + + if (!SafeZoneIndicator) + return true; + + /* + + 10.40 + + bool __fastcall sub_7FF68F5A83A0(__int64 SafeZoneIndicator, float *a2) + { + __m128 v2; // xmm1 + float v3; // xmm2_4 + + v2 = *(*(SafeZoneIndicator + 928) + 464i64); + v3 = _mm_shuffle_ps(v2, v2, 85).m128_f32[0]; + return (*(SafeZoneIndicator + 924) * *(SafeZoneIndicator + 924)) >= (((v3 - a2[1]) * (v3 - a2[1])) + + ((v2.m128_f32[0] - *a2) * (v2.m128_f32[0] - *a2))); + } + + If this returns true, then return true + + */ + + return true; // Do this until we implement ^^ + } + return false; + } struct { AFortPlayerState* PlayerState; bool ReturnValue; } AFortGameStateZone_IsRespawningAllowed_Params{PlayerState}; this->ProcessEvent(IsRespawningAllowedFn, &AFortGameStateZone_IsRespawningAllowed_Params); diff --git a/Project Reboot 3.0/FortLootPackage.cpp b/Project Reboot 3.0/FortLootPackage.cpp index c8dd07f..cd9eb85 100644 --- a/Project Reboot 3.0/FortLootPackage.cpp +++ b/Project Reboot 3.0/FortLootPackage.cpp @@ -312,7 +312,7 @@ std::vector PickLootDrops(FName TierGroupName, bool bPrint, int recurs if (!LootPackage) continue; - if (LootPackage->GetLootPackageID() == ChosenRowLootTierData->GetLootPackage() && LootPackage->GetWeight() != 0) + if (LootPackage->GetLootPackageID() == ChosenRowLootTierData->GetLootPackage() && LootPackage->GetWeight() != 0 && LootPackage->GetCount() != 0) { TierGroupLPs.push_back(LootPackage); } @@ -409,7 +409,7 @@ std::vector PickLootDrops(FName TierGroupName, bool bPrint, int recurs auto LootPackage = (FFortLootPackageData*)CurrentLP.Value(); - if (LootPackage->GetLootPackageID().ToString() == TierGroupLPStr && LootPackage->GetWeight() != 0) + if (LootPackage->GetLootPackageID().ToString() == TierGroupLPStr && LootPackage->GetWeight() != 0 && LootPackage->GetCount() != 0) { lootPackageCalls.push_back(LootPackage); } diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index f88551f..076f594 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -169,13 +169,13 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame* FVector LocationToSpawnLoot = ReceivingActor->GetActorLocation() + ReceivingActor->GetActorRightVector() * 70.f + FVector{ 0, 0, 50 }; static auto FortAthenaVehicleClass = FindObject("/Script/FortniteGame.FortAthenaVehicle"); + static auto SearchAnimationCountOffset = FindOffsetStruct("/Script/FortniteGame.FortSearchBounceData", "SearchAnimationCount"); if (auto BuildingContainer = Cast(ReceivingActor)) { static auto bAlreadySearchedOffset = BuildingContainer->GetOffset("bAlreadySearched"); static auto SearchBounceDataOffset = BuildingContainer->GetOffset("SearchBounceData"); static auto bAlreadySearchedFieldMask = GetFieldMask(BuildingContainer->GetProperty("bAlreadySearched")); - static auto SearchAnimationCountOffset = FindOffsetStruct("/Script/FortniteGame.FortSearchBounceData", "SearchAnimationCount"); auto SearchBounceData = BuildingContainer->GetPtr(SearchBounceDataOffset); diff --git a/Project Reboot 3.0/FortPlayerPawn.cpp b/Project Reboot 3.0/FortPlayerPawn.cpp index 4b40026..77b2aa2 100644 --- a/Project Reboot 3.0/FortPlayerPawn.cpp +++ b/Project Reboot 3.0/FortPlayerPawn.cpp @@ -14,6 +14,40 @@ void AFortPlayerPawn::ServerChoosePart(EFortCustomPartType Part, UObject* Chosen this->ProcessEvent(fn, &AFortPlayerPawn_ServerChoosePart_Params); } +void AFortPlayerPawn::ForceLaunchPlayerZiplinine() // Thanks android +{ + float ZiplineJumpDampening = -0.5f; + float ZiplineJumpStrength = 1500.f; + + static auto CharacterMovementOffset = GetOffset("CharacterMovement"); + auto CharacterMovement = this->Get(CharacterMovementOffset); + + static auto VelocityOffset = CharacterMovement->GetOffset("Velocity"); + auto& v23 = CharacterMovement->Get(VelocityOffset); + //v23.X = abs(v23.X); + //v23.Y = abs(v23.Y); + + FVector v21 = { -750, -750, ZiplineJumpStrength }; + + if (ZiplineJumpDampening * v23.X >= -750.f) + v21.X = fminf(ZiplineJumpDampening * v23.X, 750); + + if (ZiplineJumpDampening * v23.Y >= -750.f) + v21.Y = fminf(ZiplineJumpDampening * v23.Y, 750); + + // todo check if in vehicle + + static auto LaunchCharacterFn = FindObject("/Script/Engine.Character.LaunchCharacter"); + + struct + { + FVector LaunchVelocity; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) + bool bXYOverride; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) + bool bZOverride; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) + } ACharacter_LaunchCharacter_Params{ v21, false, false }; + ProcessEvent(LaunchCharacterFn, &ACharacter_LaunchCharacter_Params); +} + void AFortPlayerPawn::ServerSendZiplineStateHook(AFortPlayerPawn* Pawn, FZiplinePawnState InZiplineState) { static auto ZiplineStateOffset = Pawn->GetOffset("ZiplineState"); @@ -28,9 +62,18 @@ void AFortPlayerPawn::ServerSendZiplineStateHook(AFortPlayerPawn* Pawn, FZipline static auto ZiplinePawnStateSize = ZiplinePawnStateStruct->GetPropertiesSize(); CopyStruct(PawnZiplineState, &InZiplineState, ZiplinePawnStateSize); - } - static bool bFoundFunc = false; + static auto bIsZipliningOffset = FindOffsetStruct("/Script/FortniteGame.ZiplinePawnState", "bIsZiplining"); + static auto bJumpedOffset = FindOffsetStruct("/Script/FortniteGame.ZiplinePawnState", "bJumped"); + + if (!(*(bool*)(__int64(PawnZiplineState) + bIsZipliningOffset))) + { + if ((*(bool*)(__int64(PawnZiplineState) + bJumpedOffset))) + { + Pawn->ForceLaunchPlayerZiplinine(); + } + } + } static void (*OnRep_ZiplineState)(AFortPlayerPawn* Pawn) = decltype(OnRep_ZiplineState)(Addresses::OnRep_ZiplineState); diff --git a/Project Reboot 3.0/FortPlayerPawn.h b/Project Reboot 3.0/FortPlayerPawn.h index 0e34f8e..b4efb95 100644 --- a/Project Reboot 3.0/FortPlayerPawn.h +++ b/Project Reboot 3.0/FortPlayerPawn.h @@ -23,6 +23,7 @@ class AFortPlayerPawn : public AFortPawn { public: void ServerChoosePart(EFortCustomPartType Part, class UObject* ChosenCharacterPart); + void ForceLaunchPlayerZiplinine(); // Thanks android static void ServerSendZiplineStateHook(AFortPlayerPawn* Pawn, FZiplinePawnState InZiplineState); static void ServerHandlePickupHook(AFortPlayerPawn* Pawn, AFortPickup* Pickup, float InFlyTime, FVector InStartDirection, bool bPlayPickupSound); diff --git a/Project Reboot 3.0/FortPlayerStateAthena.cpp b/Project Reboot 3.0/FortPlayerStateAthena.cpp new file mode 100644 index 0000000..b658322 --- /dev/null +++ b/Project Reboot 3.0/FortPlayerStateAthena.cpp @@ -0,0 +1,58 @@ +#include "FortPlayerStateAthena.h" +#include "Stack.h" +#include "FortPlayerControllerAthena.h" + +void AFortPlayerStateAthena::ServerSetInAircraftHook(UObject* Context, FFrame& Stack, void* Ret) +{ + auto PlayerState = (AFortPlayerStateAthena*)Context; + auto PlayerController = Cast(PlayerState->GetOwner()); + + if (!PlayerController) + return; + + // std::cout << "bNewInAircraft: " << bNewInAircraft << '\n'; + // std::cout << "PlayerController->IsInAircraft(): " << PlayerController->IsInAircraft() << '\n'; + + struct aaa { bool wtf; }; + + auto bNewInAircraft = ((aaa*)Stack.Locals)->wtf;// *(bool*)Stack.Locals; + auto WorldInventory = PlayerController->GetWorldInventory(); + auto& InventoryList = WorldInventory->GetItemList(); + + auto& ItemInstances = InventoryList.GetItemInstances(); + + if ((/* (bNewInAircraft && !PlayerController->IsInAircraft()) || */ (Globals::bLateGame ? bNewInAircraft : true)) && ItemInstances.Num()) + { + // std::cout << "InventoryList.ItemInstances.Num(): " << InventoryList.ItemInstances.Num() << '\n'; + + std::vector> GuidAndCountsToRemove; + + for (int i = 0; i < ItemInstances.Num(); i++) + { + auto ItemEntry = ItemInstances.at(i)->GetItemEntry(); + auto ItemDefinition = Cast(ItemEntry->GetItemDefinition()); + + if (!ItemDefinition) + continue; + + if (!ItemDefinition->CanBeDropped()) + continue; + + GuidAndCountsToRemove.push_back({ ItemEntry->GetItemGuid(), ItemEntry->GetCount() }); + } + + for (auto& Pair : GuidAndCountsToRemove) + { + WorldInventory->RemoveItem(Pair.first, nullptr, Pair.second); + } + + WorldInventory->Update(); + + static auto CurrentShieldOffset = PlayerState->GetOffset("CurrentShield"); + + if (CurrentShieldOffset != -1) + PlayerState->Get(CurrentShieldOffset) = 0; // real + } + + return ServerSetInAircraftOriginal(Context, Stack, Ret); +} \ No newline at end of file diff --git a/Project Reboot 3.0/FortPlayerStateAthena.h b/Project Reboot 3.0/FortPlayerStateAthena.h index 31319da..fb0217d 100644 --- a/Project Reboot 3.0/FortPlayerStateAthena.h +++ b/Project Reboot 3.0/FortPlayerStateAthena.h @@ -1,10 +1,13 @@ #pragma once #include "FortPlayerState.h" +#include "Stack.h" class AFortPlayerStateAthena : public AFortPlayerState { public: + static inline void (*ServerSetInAircraftOriginal)(UObject* Context, FFrame& Stack, void* Ret); + uint8& GetSquadId() { static auto SquadIdOffset = GetOffset("SquadId"); @@ -31,6 +34,8 @@ public: this->ProcessEvent(ClientReportKillFn, &Player); } + static void ServerSetInAircraftHook(UObject* Context, FFrame& Stack, void* Ret); + static UClass* StaticClass() { static auto Class = FindObject("/Script/FortniteGame.FortPlayerStateAthena"); diff --git a/Project Reboot 3.0/GameModeBase.cpp b/Project Reboot 3.0/GameModeBase.cpp index 09c7704..0cd1a75 100644 --- a/Project Reboot 3.0/GameModeBase.cpp +++ b/Project Reboot 3.0/GameModeBase.cpp @@ -29,10 +29,20 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll static auto fn = FindObject(L"/Script/Engine.GameModeBase.SpawnDefaultPawnAtTransform"); - struct { AController* NewPlayer; FTransform SpawnTransform; APawn* ReturnValue; } - AGameModeBase_SpawnDefaultPawnAtTransform_Params{NewPlayer, StartSpot->GetTransform()}; + FTransform SpawnTransform = StartSpot->GetTransform(); - GameMode->ProcessEvent(fn, &AGameModeBase_SpawnDefaultPawnAtTransform_Params); + struct { AController* NewPlayer; FTransform SpawnTransform; APawn* ReturnValue; } + AGameModeBase_SpawnDefaultPawnAtTransform_Params{NewPlayer, SpawnTransform }; + + // GameMode->ProcessEvent(fn, &AGameModeBase_SpawnDefaultPawnAtTransform_Params); + + FActorSpawnParameters SpawnParameters{}; + SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn; + + auto NewPawn = GetWorld()->SpawnActor(PawnClass, SpawnTransform, SpawnParameters); // AGameModeBase_SpawnDefaultPawnAtTransform_Params.ReturnValue; + + if (!NewPawn) + return nullptr; bool bIsRespawning = false; @@ -68,8 +78,8 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll 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(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); @@ -78,5 +88,5 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll } } - return AGameModeBase_SpawnDefaultPawnAtTransform_Params.ReturnValue; + return NewPawn; } \ No newline at end of file diff --git a/Project Reboot 3.0/Project Reboot 3.0.vcxproj b/Project Reboot 3.0/Project Reboot 3.0.vcxproj index 96996ce..edc47fb 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj @@ -198,6 +198,7 @@ + @@ -233,6 +234,7 @@ + diff --git a/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters b/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters index 5243676..b243f70 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters @@ -164,6 +164,9 @@ Engine\Source\Runtime\Engine\Private + + FortniteGame\Source\FortniteGame\Private\Player + @@ -470,6 +473,9 @@ Engine\Source\Runtime\CoreUObject\Public\Misc + + FortniteGame\Source\FortniteGame\Public\Building\GameplayActors + diff --git a/Project Reboot 3.0/SoftObjectPtr.h b/Project Reboot 3.0/SoftObjectPtr.h index 85793ee..c76fbef 100644 --- a/Project Reboot 3.0/SoftObjectPtr.h +++ b/Project Reboot 3.0/SoftObjectPtr.h @@ -19,7 +19,7 @@ struct TSoftObjectPtr public: FSoftObjectPtr SoftObjectPtr; - T* Get() + T* Get(UClass* ClassToLoad = nullptr, bool bTryToLoad = false) { if (Engine_Version <= 416) { @@ -31,6 +31,11 @@ public: if (SoftObjectPtr.ObjectID.AssetPathName.ComparisonIndex.Value <= 0) return nullptr; + if (bTryToLoad) + { + return LoadObject(SoftObjectPtr.ObjectID.AssetPathName.ToString(), ClassToLoad); + } + return FindObject(SoftObjectPtr.ObjectID.AssetPathName.ToString()); } } diff --git a/Project Reboot 3.0/World.cpp b/Project Reboot 3.0/World.cpp index fe7af7d..28d4343 100644 --- a/Project Reboot 3.0/World.cpp +++ b/Project Reboot 3.0/World.cpp @@ -79,5 +79,5 @@ void UWorld::Listen() *(UNetDriver**)(__int64(LevelCollections.AtPtr(0, LevelCollectionSize)) + 0x10) = NewNetDriver; *(UNetDriver**)(__int64(LevelCollections.AtPtr(1, LevelCollectionSize)) + 0x10) = NewNetDriver; - LOG_INFO(LogNet, "Listening on port {}!", Port); + LOG_INFO(LogNet, "Listening on port {}!", Port + AmountOfRestarts); } \ No newline at end of file diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index 2cf5f1a..4880370 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -96,6 +96,7 @@ DWORD WINAPI Main(LPVOID) static auto FortPlayerControllerAthenaDefault = FindObject(L"/Script/FortniteGame.Default__FortPlayerControllerAthena"); // FindObject(L"/Game/Athena/Athena_PlayerController.Default__Athena_PlayerController_C"); static auto FortPlayerPawnAthenaDefault = FindObject(L"/Game/Athena/PlayerPawn_Athena.Default__PlayerPawn_Athena_C"); static auto FortAbilitySystemComponentAthenaDefault = FindObject(L"/Script/FortniteGame.Default__FortAbilitySystemComponentAthena"); + static auto FortPlayerStateAthenaDefault = FindObject(L"/Script/FortniteGame.Default__FortPlayerStateAthena"); static auto FortKismetLibraryDefault = FindObject(L"/Script/FortniteGame.Default__FortKismetLibrary"); static auto AthenaMarkerComponentDefault = FindObject(L"/Script/FortniteGame.Default__AthenaMarkerComponent"); @@ -287,6 +288,9 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerTeleportToPlaygroundLobbyIsland"), AFortPlayerControllerAthena::ServerTeleportToPlaygroundLobbyIslandHook, nullptr, false); + Hooking::MinHook::Hook(FortPlayerStateAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerStateAthena.ServerSetInAircraft"), + AFortPlayerStateAthena::ServerSetInAircraftHook, (PVOID*)&AFortPlayerStateAthena::ServerSetInAircraftOriginal, false, true); // We could use second method but eh + Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerPawn.ServerSendZiplineState"), AFortPlayerPawn::ServerSendZiplineStateHook, nullptr, false); @@ -376,23 +380,32 @@ DWORD WINAPI Main(LPVOID) if (Globals::bAbilitiesEnabled) { - if (PredictionKeySize == 0x10) + int InternalServerTryActivateAbilityIndex = 0; + + if (Engine_Version > 420) { - Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbility"), - UAbilitySystemComponent::ServerTryActivateAbilityHook1, nullptr, false); - Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbilityWithEventData"), - UAbilitySystemComponent::ServerTryActivateAbilityWithEventDataHook1, nullptr, false); + static auto OnRep_ReplicatedAnimMontageFn = FindObject("/Script/GameplayAbilities.AbilitySystemComponent.OnRep_ReplicatedAnimMontage"); + InternalServerTryActivateAbilityIndex = (GetFunctionIdxOrPtr(OnRep_ReplicatedAnimMontageFn) - 8) / 8; } - else if (PredictionKeySize == 0x18) + else { - Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbility"), - UAbilitySystemComponent::ServerTryActivateAbilityHook2, nullptr, false); - Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbilityWithEventData"), - UAbilitySystemComponent::ServerTryActivateAbilityWithEventDataHook2, nullptr, false); + static auto ServerTryActivateAbilityWithEventDataFn = FindObject(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbilityWithEventData"); + auto ServerTryActivateAbilityWithEventDataNativeAddr = __int64(FortAbilitySystemComponentAthenaDefault->VFTable[GetFunctionIdxOrPtr(ServerTryActivateAbilityWithEventDataFn) / 8]); + + for (int i = 0; i < 400; i++) + { + if ((*(uint8_t*)(ServerTryActivateAbilityWithEventDataNativeAddr + i) == 0xFF && *(uint8_t*)(ServerTryActivateAbilityWithEventDataNativeAddr + i + 1) == 0x90) || // call qword ptr + (*(uint8_t*)(ServerTryActivateAbilityWithEventDataNativeAddr + i) == 0xFF && *(uint8_t*)(ServerTryActivateAbilityWithEventDataNativeAddr + i + 1) == 0x93)) // call qword ptr + { + InternalServerTryActivateAbilityIndex = GetIndexFromVirtualFunctionCall(ServerTryActivateAbilityWithEventDataNativeAddr + i) / 8; + break; + } + } } - // Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerAbilityRPCBatch"), - // UAbilitySystemComponent::ServerAbilityRPCBatchHook, nullptr, false); + LOG_INFO(LogDev, "InternalServerTryActivateAbilityIndex: 0x{:x}", InternalServerTryActivateAbilityIndex); + + VirtualSwap(FortAbilitySystemComponentAthenaDefault->VFTable, InternalServerTryActivateAbilityIndex, UAbilitySystemComponent::InternalServerTryActivateAbilityHook); } if (Engine_Version >= 424) diff --git a/Project Reboot 3.0/finder.h b/Project Reboot 3.0/finder.h index 96c6a0d..0be0712 100644 --- a/Project Reboot 3.0/finder.h +++ b/Project Reboot 3.0/finder.h @@ -1169,7 +1169,7 @@ static inline uint64 FindReplaceBuildingActor() } return FindBytes(StringRef, - (Engine_Version == 420 || Engine_Version == 421 || Fortnite_Version >= 18 ? std::vector{ 0x48, 0x8B, 0xC4 } : std::vector{ 0x4C, 0x8B }), + (Engine_Version == 420 || Engine_Version == 421 || Engine_Version >= 427 ? std::vector{ 0x48, 0x8B, 0xC4 } : std::vector{ 0x4C, 0x8B }), 1000, 0, true); } diff --git a/Project Reboot 3.0/globals.h b/Project Reboot 3.0/globals.h index 711aec5..d8245cb 100644 --- a/Project Reboot 3.0/globals.h +++ b/Project Reboot 3.0/globals.h @@ -4,7 +4,7 @@ namespace Globals { extern inline bool bCreative = false; extern inline bool bGoingToPlayEvent = false; - extern inline bool bNoMCP = true; + extern inline bool bNoMCP = false; extern inline bool bLateGame = false; extern inline bool bAbilitiesEnabled = true; extern inline bool bLogProcessEvent = false; diff --git a/Project Reboot 3.0/hooking.h b/Project Reboot 3.0/hooking.h index 681c727..ba6cb55 100644 --- a/Project Reboot 3.0/hooking.h +++ b/Project Reboot 3.0/hooking.h @@ -77,6 +77,37 @@ inline __int64 GetFunctionIdxOrPtr2(UFunction* Function) return functionAddyOrOffset; } +inline __int64 GetIndexFromVirtualFunctionCall(__int64 NativeAddr) +{ + std::string wtf = ""; + + int shots = 0; + + bool bFoundFirstNumber = false; + + for (__int64 z = (NativeAddr + 5); z != (NativeAddr + 1); z -= 1) + { + auto anafa = (int)(*(uint8_t*)z); + + auto asfk = anafa < 10 ? "0" + std::format("{:x}", anafa) : std::format("{:x}", anafa); + + // std::cout << std::format("[{}] 0x{}\n", shots, asfk); + + if (*(uint8_t*)z == 0 ? bFoundFirstNumber : true) + { + wtf += asfk; + bFoundFirstNumber = true; + } + + shots++; + } + + std::transform(wtf.begin(), wtf.end(), wtf.begin(), ::toupper); + + // LOG_INFO(LogDev, "wtf: {}", wtf); + + return HexToDec(wtf); +} inline __int64 GetFunctionIdxOrPtr(UFunction* Function) { @@ -114,34 +145,7 @@ inline __int64 GetFunctionIdxOrPtr(UFunction* Function) { if (bFoundValidate) { - std::string wtf = ""; - - int shots = 0; - - bool bFoundFirstNumber = false; - - for (__int64 z = (NativeAddr + i + 5); z != (NativeAddr + i + 1); z -= 1) - { - auto anafa = (int)(*(uint8_t*)z); - - auto asfk = anafa < 10 ? "0" + std::format("{:x}", anafa) : std::format("{:x}", anafa); - - // std::cout << std::format("[{}] 0x{}\n", shots, asfk); - - if (*(uint8_t*)z == 0 ? bFoundFirstNumber : true) - { - wtf += asfk; - bFoundFirstNumber = true; - } - - shots++; - } - - std::transform(wtf.begin(), wtf.end(), wtf.begin(), ::toupper); - - // LOG_INFO(LogDev, "wtf: {}", wtf); - - return HexToDec(wtf); + return GetIndexFromVirtualFunctionCall(NativeAddr + i); } else { diff --git a/Project Reboot 3.0/vehicles.h b/Project Reboot 3.0/vehicles.h index 2347139..d6124fd 100644 --- a/Project Reboot 3.0/vehicles.h +++ b/Project Reboot 3.0/vehicles.h @@ -128,11 +128,12 @@ static inline AActor* SpawnVehicleFromSpawner(AActor* VehicleSpawner) SpawnTransform.Scale3D = { 1, 1, 1 }; static auto VehicleClassOffset = VehicleSpawner->GetOffset("VehicleClass", false); + static auto BGAClass = FindObject("/Script/Engine.BlueprintGeneratedClass"); if (VehicleClassOffset != -1) // 10.40 and below? { auto& SoftVehicleClass = VehicleSpawner->Get>(VehicleClassOffset); - auto StrongVehicleClass = SoftVehicleClass.Get(); + auto StrongVehicleClass = SoftVehicleClass.Get(BGAClass, true); if (!StrongVehicleClass) { @@ -150,7 +151,7 @@ static inline AActor* SpawnVehicleFromSpawner(AActor* VehicleSpawner) return nullptr; auto& SoftFortVehicleItemDef = VehicleSpawner->Get>(FortVehicleItemDefOffset); - auto StrongFortVehicleItemDef = SoftFortVehicleItemDef.Get(); + auto StrongFortVehicleItemDef = SoftFortVehicleItemDef.Get(nullptr, true); if (!StrongFortVehicleItemDef) { @@ -161,7 +162,7 @@ static inline AActor* SpawnVehicleFromSpawner(AActor* VehicleSpawner) static auto VehicleActorClassOffset = StrongFortVehicleItemDef->GetOffset("VehicleActorClass"); auto& SoftVehicleActorClass = StrongFortVehicleItemDef->Get>(VehicleActorClassOffset); - auto StrongVehicleActorClass = SoftVehicleActorClass.Get(); + auto StrongVehicleActorClass = SoftVehicleActorClass.Get(BGAClass, true); if (!StrongVehicleActorClass) {