diff --git a/Project Reboot 3.0/AbilitySystemComponent_Abilities.cpp b/Project Reboot 3.0/AbilitySystemComponent_Abilities.cpp index 7de9a57..7c1e041 100644 --- a/Project Reboot 3.0/AbilitySystemComponent_Abilities.cpp +++ b/Project Reboot 3.0/AbilitySystemComponent_Abilities.cpp @@ -68,6 +68,8 @@ void UAbilitySystemComponent::ServerEndAbility(FGameplayAbilitySpecHandle Abilit CopyStruct((FPredictionKey*)(__int64(Params) + PredictionKeyOffset), PredictionKey, FPredictionKey::GetStructSize()); this->ProcessEvent(ServerEndAbilityFn, Params); + + VirtualFree(Params, 0, MEM_RELEASE); } void UAbilitySystemComponent::ClientEndAbility(FGameplayAbilitySpecHandle AbilityToEnd, FGameplayAbilityActivationInfo* ActivationInfo) @@ -83,6 +85,8 @@ void UAbilitySystemComponent::ClientEndAbility(FGameplayAbilitySpecHandle Abilit CopyStruct((FGameplayAbilityActivationInfo*)(__int64(Params) + ActivationInfoOffset), ActivationInfo, FGameplayAbilityActivationInfo::GetStructSize()); this->ProcessEvent(ClientEndAbilityFn, Params); + + VirtualFree(Params, 0, MEM_RELEASE); } void UAbilitySystemComponent::ClientCancelAbility(FGameplayAbilitySpecHandle AbilityToCancel, FGameplayAbilityActivationInfo* ActivationInfo) @@ -98,6 +102,8 @@ void UAbilitySystemComponent::ClientCancelAbility(FGameplayAbilitySpecHandle Abi CopyStruct((FGameplayAbilityActivationInfo*)(__int64(Params) + ActivationInfoOffset), ActivationInfo, FGameplayAbilityActivationInfo::GetStructSize()); this->ProcessEvent(ClientCancelAbilityFn, Params); + + VirtualFree(Params, 0, MEM_RELEASE); } bool UAbilitySystemComponent::HasAbility(UObject* DefaultAbility) diff --git a/Project Reboot 3.0/Array.h b/Project Reboot 3.0/Array.h index 35f1073..372d130 100644 --- a/Project Reboot 3.0/Array.h +++ b/Project Reboot 3.0/Array.h @@ -326,16 +326,19 @@ public: void FreeGood(SizeType Size = sizeof(InElementType)) { - if (true) + if (Data) { - static void (*FreeOriginal)(void* Original) = decltype(FreeOriginal)(Addresses::Free); + if (true) + { + static void (*FreeOriginal)(void* Original) = decltype(FreeOriginal)(Addresses::Free); - if (FreeOriginal) - FreeOriginal(Data); - } - else - { - VirtualFree(Data, 0, MEM_RELEASE); + if (FreeOriginal) + FreeOriginal(Data); + } + else + { + VirtualFree(Data, 0, MEM_RELEASE); + } } Data = nullptr; diff --git a/Project Reboot 3.0/CheatManager.cpp b/Project Reboot 3.0/CheatManager.cpp index 744b7b2..f2e77ba 100644 --- a/Project Reboot 3.0/CheatManager.cpp +++ b/Project Reboot 3.0/CheatManager.cpp @@ -4,12 +4,12 @@ void UCheatManager::Teleport() { - static auto TeleportFn = FindObject("/Script/Engine.CheatManager.Teleport"); + static auto TeleportFn = FindObject(L"/Script/Engine.CheatManager.Teleport"); this->ProcessEvent(TeleportFn); } UClass* UCheatManager::StaticClass() { - static auto Class = FindObject("/Script/Engine.CheatManager"); + static auto Class = FindObject(L"/Script/Engine.CheatManager"); return Class; } \ No newline at end of file diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index 1a933fd..af8cef5 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -130,6 +130,37 @@ UClass* AFortGameModeAthena::GetVehicleClassOverride(UClass* DefaultClass) return GetVehicleClassOverride_Params.ReturnValue; } +void AFortGameModeAthena::SkipAircraft() +{ + // reversed from 10.40 + + auto GameState = GetGameStateAthena(); + + static auto bGameModeWillSkipAircraftOffset = GameState->GetOffset("bGameModeWillSkipAircraft", false); + + if (bGameModeWillSkipAircraftOffset != -1) // hmm? + GameState->Get(bGameModeWillSkipAircraftOffset) = true; + + static auto OnAircraftExitedDropZoneFn = FindObject("/Script/FortniteGame.FortGameModeAthena.OnAircraftExitedDropZone"); + + static auto AircraftsOffset = GameState->GetOffset("Aircrafts", false); + + if (AircraftsOffset == -1) + { + static auto AircraftOffset = GameState->GetOffset("Aircraft"); + this->ProcessEvent(OnAircraftExitedDropZoneFn, &GameState->Get(AircraftOffset)); + } + else + { + auto Aircrafts = GameState->GetPtr>(AircraftsOffset); + + for (int i = 0; i < Aircrafts->Num(); i++) + { + this->ProcessEvent(OnAircraftExitedDropZoneFn, &Aircrafts->at(i)); + } + } +} + void AFortGameModeAthena::HandleSpawnRateForActorClass(UClass* ActorClass, float SpawnPercentage) { TArray AllActors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), ActorClass); @@ -466,7 +497,7 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game ShowFoundation(Lake); } - auto FloatingIsland = Fortnite_Version == 6.10 ? FindObject(L"/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_StreamingTest13") : + auto FloatingIsland = Fortnite_Version <= 6.10 ? FindObject(L"/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_StreamingTest13") : FindObject(L"/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_FloatingIsland"); ShowFoundation(FloatingIsland); @@ -1138,8 +1169,8 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena } } - auto SpawnIsland_FloorLoot = FindObject("/Game/Athena/Environments/Blueprints/Tiered_Athena_FloorLoot_Warmup.Tiered_Athena_FloorLoot_Warmup_C"); - auto BRIsland_FloorLoot = FindObject("/Game/Athena/Environments/Blueprints/Tiered_Athena_FloorLoot_01.Tiered_Athena_FloorLoot_01_C"); + auto SpawnIsland_FloorLoot = FindObject(L"/Game/Athena/Environments/Blueprints/Tiered_Athena_FloorLoot_Warmup.Tiered_Athena_FloorLoot_Warmup_C"); + auto BRIsland_FloorLoot = FindObject(L"/Game/Athena/Environments/Blueprints/Tiered_Athena_FloorLoot_01.Tiered_Athena_FloorLoot_01_C"); TArray SpawnIsland_FloorLoot_Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), SpawnIsland_FloorLoot); TArray BRIsland_FloorLoot_Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), BRIsland_FloorLoot); diff --git a/Project Reboot 3.0/FortGameModeAthena.h b/Project Reboot 3.0/FortGameModeAthena.h index 5d10264..d8c059b 100644 --- a/Project Reboot 3.0/FortGameModeAthena.h +++ b/Project Reboot 3.0/FortGameModeAthena.h @@ -244,6 +244,7 @@ public: FName RedirectLootTier(const FName& LootTier); UClass* GetVehicleClassOverride(UClass* DefaultClass); + void SkipAircraft(); void PauseSafeZone(bool bPaused = true); static void HandleSpawnRateForActorClass(UClass* ActorClass, float SpawnPercentage); // idk where to put diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index 2ef95a9..b2611d5 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -636,30 +636,31 @@ void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController* // if (!PlayerController->bInAircraft) // return; + LOG_INFO(LogDev, "ServerAttemptAircraftJumpHook!"); + auto GameMode = (AFortGameModeAthena*)GetWorld()->GetGameMode(); + auto GameState = GameMode->GetGameStateAthena(); + + AActor* AircraftToJumpFrom = nullptr; + + static auto AircraftsOffset = GameState->GetOffset("Aircrafts", false); + + if (AircraftsOffset == -1) + { + static auto AircraftOffset = GameState->GetOffset("Aircraft"); + AircraftToJumpFrom = GameState->Get(AircraftOffset); + } + else + { + auto Aircrafts = GameState->GetPtr>(AircraftsOffset); + AircraftToJumpFrom = Aircrafts->Num() > 0 ? Aircrafts->at(0) : nullptr; // skunky + } + + if (!AircraftToJumpFrom) + return ServerAttemptAircraftJumpOriginal(PC, ClientRotation); if (false) { - auto GameState = GameMode->GetGameStateAthena(); - - AActor* AircraftToJumpFrom = nullptr; - - static auto AircraftsOffset = GameState->GetOffset("Aircrafts", false); - - if (AircraftsOffset == -1) - { - static auto AircraftOffset = GameState->GetOffset("Aircraft"); - AircraftToJumpFrom = GameState->Get(AircraftOffset); - } - else - { - auto Aircrafts = GameState->GetPtr>(AircraftsOffset); - AircraftToJumpFrom = Aircrafts->Num() > 0 ? Aircrafts->at(0) : nullptr; - } - - if (!AircraftToJumpFrom) - return ServerAttemptAircraftJumpOriginal(PC, ClientRotation); - auto NewPawn = GameMode->SpawnDefaultPawnForHook(GameMode, (AController*)PlayerController, AircraftToJumpFrom); PlayerController->Possess(NewPawn); } @@ -699,7 +700,11 @@ void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController* NewPawnAsFort->SetHealth(100); // needed with server restart player? if (Globals::bLateGame) + { NewPawnAsFort->SetShield(100); + + NewPawnAsFort->TeleportTo(AircraftToJumpFrom->GetActorLocation(), FRotator()); + } } // PlayerController->ServerRestartPlayer(); diff --git a/Project Reboot 3.0/FortPlayerPawnAthena.cpp b/Project Reboot 3.0/FortPlayerPawnAthena.cpp index 097bfa1..2c35d02 100644 --- a/Project Reboot 3.0/FortPlayerPawnAthena.cpp +++ b/Project Reboot 3.0/FortPlayerPawnAthena.cpp @@ -100,7 +100,7 @@ void AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook(UObject* Context, FFrame* // std::cout << "bFoundStack: " << bFoundStack << '\n'; if (!bCanStack ? (!bFoundStack ? true : ItemDefinition->DoesAllowMultipleStacks()) : true) - ServerHandlePickupHook(Pawn, Pickup, 0.4, FVector(), true); + ServerHandlePickupHook(Pawn, Pickup, 0.4f, FVector(), true); } } diff --git a/Project Reboot 3.0/GameModeBase.cpp b/Project Reboot 3.0/GameModeBase.cpp index 278b525..b9e3939 100644 --- a/Project Reboot 3.0/GameModeBase.cpp +++ b/Project Reboot 3.0/GameModeBase.cpp @@ -225,43 +225,6 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll WorldInventory->Update(); } - else - { - if (GameState->GetGamePhase() == EAthenaGamePhase::Aircraft) - { - if (Globals::bLateGame) - { - static auto WoodItemData = FindObject(L"/Game/Items/ResourcePickups/WoodItemData.WoodItemData"); - static auto StoneItemData = FindObject(L"/Game/Items/ResourcePickups/StoneItemData.StoneItemData"); - static auto MetalItemData = FindObject(L"/Game/Items/ResourcePickups/MetalItemData.MetalItemData"); - - static auto Rifle = FindObject(L"/Game/Athena/Items/Weapons/WID_Assault_AutoHigh_Athena_SR_Ore_T03.WID_Assault_AutoHigh_Athena_SR_Ore_T03"); - static auto Shotgun = FindObject(L"/Game/Athena/Items/Weapons/WID_Shotgun_Standard_Athena_SR_Ore_T03.WID_Shotgun_Standard_Athena_SR_Ore_T03"); - static auto SMG = FindObject(L"/Game/Athena/Items/Weapons/WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03.WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03"); - - static auto MiniShields = FindObject(L"/Game/Athena/Items/Consumables/ShieldSmall/Athena_ShieldSmall.Athena_ShieldSmall"); - - static auto Shells = FindObject(L"/Game/Athena/Items/Ammo/AthenaAmmoDataShells.AthenaAmmoDataShells"); - static auto Medium = FindObject(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsMedium.AthenaAmmoDataBulletsMedium"); - static auto Light = FindObject(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsLight.AthenaAmmoDataBulletsLight"); - static auto Heavy = FindObject(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsHeavy.AthenaAmmoDataBulletsHeavy"); - - 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(); - } - } - } } else { diff --git a/Project Reboot 3.0/KismetSystemLibrary.h b/Project Reboot 3.0/KismetSystemLibrary.h index b1c87fb..7c31348 100644 --- a/Project Reboot 3.0/KismetSystemLibrary.h +++ b/Project Reboot 3.0/KismetSystemLibrary.h @@ -146,22 +146,24 @@ public: ((UKismetSystemLibrary_LineTraceSingle_Params*)Params)->bTraceComplex = bTraceComplex; *(bool*)(__int64(Params) + bIgnoreSelfOffset) = bIgnoreSelf; - static auto KismetSystemLibrary = FindObject("/Script/Engine.Default__KismetSystemLibrary"); + static auto KismetSystemLibrary = FindObject(L"/Script/Engine.Default__KismetSystemLibrary"); KismetSystemLibrary->ProcessEvent(LineTraceSingleFn, Params); if (OutHit) *OutHit = (FHitResult*)(__int64(Params) + OutHitOffset); - return *(bool*)(__int64(Params) + ReturnValueOffset); + bool ReturnValue = *(bool*)(__int64(Params) + ReturnValueOffset); - // free params frfr + // VirtualFree(Params, 0, MEM_RELEASE); + + return ReturnValue; } static bool LineTraceSingleByProfile(UObject* WorldContextObject, const FVector& Start, const FVector& End, FName ProfileName, bool bTraceComplex, const TArray& ActorsToIgnore, EDrawDebugTrace DrawDebugType, FHitResult** OutHit, bool bIgnoreSelf, const FLinearColor& TraceColor, const FLinearColor& TraceHitColor, float DrawTime) { - auto LineTraceSingleByProfileFn = FindObject("/Script/Engine.KismetSystemLibrary.LineTraceSingleByProfile"); + auto LineTraceSingleByProfileFn = FindObject(L"/Script/Engine.KismetSystemLibrary.LineTraceSingleByProfile"); if (!LineTraceSingleByProfileFn) return false; diff --git a/Project Reboot 3.0/PlayerState.cpp b/Project Reboot 3.0/PlayerState.cpp index e1532f4..0b0e821 100644 --- a/Project Reboot 3.0/PlayerState.cpp +++ b/Project Reboot 3.0/PlayerState.cpp @@ -10,7 +10,7 @@ FString& APlayerState::GetSavedNetworkAddress() FString APlayerState::GetPlayerName() { - static auto GetPlayerNameFn = FindObject("/Script/Engine.PlayerState.GetPlayerName"); + static auto GetPlayerNameFn = FindObject(L"/Script/Engine.PlayerState.GetPlayerName"); if (GetPlayerNameFn) { diff --git a/Project Reboot 3.0/UnrealString.h b/Project Reboot 3.0/UnrealString.h index b9865fb..24637c6 100644 --- a/Project Reboot 3.0/UnrealString.h +++ b/Project Reboot 3.0/UnrealString.h @@ -5,6 +5,8 @@ #include "Array.h" #include "log.h" +// #define EXPERIMENTAL_FSTRING + class FString { public: @@ -30,18 +32,58 @@ public: return Data.Data; } - void Set(const wchar_t* NewStr) // by fischsalat + void Set(const wchar_t* NewStr) { - if (!NewStr/* || std::wcslen(NewStr) == 0 */) return; + if (!NewStr/* || std::wcslen(NewStr) == 0 */) + return; +#ifndef EXPERIMENTAL_FSTRING Data.ArrayMax = Data.ArrayNum = *NewStr ? (int)std::wcslen(NewStr) + 1 : 0; if (Data.ArrayNum) Data.Data = const_cast(NewStr); +#else + Data.ArrayNum = (int)std::wcslen(NewStr) + 1; + Data.ArrayMax = Data.ArrayNum; + + if (Data.ArrayNum > 0) // this should never happen unless std::wcslen returns negative.. + { + int amountToAlloc = (Data.ArrayNum * sizeof(TCHAR)); + + if (Addresses::Free && Addresses::Realloc) + { + Data.Data = (TCHAR*)FMemory::Realloc(0, amountToAlloc, 0); + memcpy_s(Data.Data, amountToAlloc, NewStr, amountToAlloc); + } + else + { + Data.Data = (TCHAR*)NewStr; + } + } +#endif } FString() {} +#ifdef EXPERIMENTAL_FSTRING + FString& operator=(const wchar_t* Other) + { + this->Set(Other); + return *this; + } + + FString& operator=(const FString& Other) + { + this->Set(Other.Data.Data); + return *this; + } + + FString(const FString& Other) + { + this->Set(Other.Data.Data); + } +#endif + FString(const wchar_t* str) { Set(str); @@ -49,11 +91,28 @@ public: ~FString() { +#ifdef EXPERIMENTAL_FSTRING if (Data.Data) { // LOG_INFO(LogDev, "Deconstructing FString!"); + // free(Data.Data); + + if (Addresses::Realloc && Addresses::Free) + { + static void (*freeOriginal)(void*) = decltype(freeOriginal)(Addresses::Free); + freeOriginal(Data.Data); + } + else + { + // VirtualFree(Data.Data, 0, MEM_RELEASE); + } } +#endif // Free(); + + Data.Data = nullptr; + Data.ArrayNum = 0; + Data.ArrayMax = 0; } }; \ No newline at end of file diff --git a/Project Reboot 3.0/addresses.cpp b/Project Reboot 3.0/addresses.cpp index f2b64f1..a057423 100644 --- a/Project Reboot 3.0/addresses.cpp +++ b/Project Reboot 3.0/addresses.cpp @@ -83,7 +83,7 @@ void Addresses::SetupVersion() CLStr = CLStr.substr(0, CLStr.find_first_of('+')); Fortnite_CL = std::stoi(CLStr); Engine_Version = Fortnite_CL <= 3775276 ? 416 : 419; // std::stoi(FullVersion.substr(0, FullVersion.find_first_of('-'))); - Fortnite_Version = FullVersion.contains(("Next")) ? 2.4 : 1.8; + // Fortnite_Version = FullVersion.contains(("Next")) ? 2.4 : 1.8; } // Fortnite_Season = std::floor(Fortnite_Version); @@ -581,6 +581,8 @@ std::vector Addresses::GetFunctionsToNull() { // toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 55 53 56 57 41 54 41 55 41 56 41 57 48 8D 68 A1 48 81 EC ? ? ? ? 45 33 F6 0F 29 70 A8 44 38 35").Get()); // zone // toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 55 56 57 41 54 41 55 41 56 41 57 48 8D 68 A8 48 81 EC ? ? ? ? 45").Get()); // GC + // toNull.push_back(Memcury::Scanner::FindPattern("40 53 48 83 EC 20 8B D9 E8 ? ? ? ? B2 01 8B CB E8").Get()); // GC Caller 1 + // toNull.push_back(Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 55 41 55 41 56 48 8B EC 48 83 EC 50 83 65 28 00 40 B6 05 40 38 35 ? ? ? ? 4C").Get()); // InitializeUI } if (Engine_Version >= 426) diff --git a/Project Reboot 3.0/bots.h b/Project Reboot 3.0/bots.h index 82f05c7..18e2b6d 100644 --- a/Project Reboot 3.0/bots.h +++ b/Project Reboot 3.0/bots.h @@ -4,12 +4,40 @@ #include "OnlineReplStructs.h" #include "BuildingContainer.h" +class BotPOI +{ + FVector CenterLocation; + FVector Range; // this just has to be FVector2D +}; + +class BotPOIEncounter +{ +public: + int NumChestsSearched; + int NumAmmoBoxesSearched; + int NumPlayersEncountered; +}; + class PlayerBot { public: AController* Controller = nullptr; + BotPOIEncounter currentBotEncounter; + int TotalPlayersEncountered; + std::vector POIsTraveled; float NextJumpTime = 1.0f; + void OnPlayerEncountered() + { + currentBotEncounter.NumPlayersEncountered++; + TotalPlayersEncountered++; + } + + void MoveToNewPOI() + { + + } + void Initialize(const FTransform& SpawnTransform) { auto GameState = Cast(GetWorld()->GetGameState()); diff --git a/Project Reboot 3.0/commands.h b/Project Reboot 3.0/commands.h index 6b1ea1c..66172d9 100644 --- a/Project Reboot 3.0/commands.h +++ b/Project Reboot 3.0/commands.h @@ -93,7 +93,7 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg) if (!CurrentPlayerState) continue; - auto PlayerName = CurrentPlayerState->GetPlayerName(); + FString PlayerName = CurrentPlayerState->GetPlayerName(); if (PlayerName.ToString() == player) // hopefully we arent on adifferent thread { @@ -161,6 +161,8 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg) // std::cout << "NumArgs: " << NumArgs << '\n'; + // return; + bool bSendHelpMessage = false; if (Arguments.size() >= 1) @@ -304,6 +306,12 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg) } */ else if (Command == "op") { + if (ReceivingController == PlayerController) + { + SendMessageToConsole(PlayerController, L"You can't op yourself!"); + return; + } + if (IsOp(ReceivingController)) { SendMessageToConsole(PlayerController, L"Player is already operator!"); @@ -617,11 +625,11 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg) auto& ClassName = Arguments[1]; - if (ClassName.contains("/Script/")) + /* if (ClassName.contains("/Script/")) { SendMessageToConsole(PlayerController, L"For now, we don't allow non-blueprint classes.\n"); return; - } + } */ auto Pawn = ReceivingController->GetPawn(); @@ -648,7 +656,8 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg) } static auto BGAClass = FindObject(L"/Script/Engine.BlueprintGeneratedClass"); - auto ClassObj = LoadObject(ClassName, BGAClass); + static auto ClassClass = FindObject(L"/Script/CoreUObject.Class"); + auto ClassObj = ClassName.contains("/Script/") ? FindObject(ClassName, ClassClass) : LoadObject(ClassName, BGAClass); // scuffy if (ClassObj) { diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index 56be75d..465b196 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -250,6 +250,96 @@ UObject* GetAIDirectorHook() return GameMode->Get(AIDirectorOffset); } +void ChangeLevels() +{ + constexpr bool bUseRemovePlayer = false; + constexpr bool bUseSwitchLevel = false; + constexpr bool bShouldRemoveLocalPlayer = true; + + FString LevelB = Engine_Version < 424 + ? L"open Athena_Terrain" : Engine_Version >= 500 ? Engine_Version >= 501 + ? L"open Asteria_Terrain" + : Globals::bCreative ? L"open Creative_NoApollo_Terrain" + : L"open Artemis_Terrain" + : Globals::bCreative ? L"open Creative_NoApollo_Terrain" + : L"open Apollo_Terrain"; + + FString Level = Engine_Version < 424 + ? L"Athena_Terrain" : Engine_Version >= 500 ? Engine_Version >= 501 + ? L"Asteria_Terrain" + : Globals::bCreative ? L"Creative_NoApollo_Terrain" + : L"Artemis_Terrain" + : Globals::bCreative ? L"Creative_NoApollo_Terrain" + : L"Apollo_Terrain"; + + if (bUseSwitchLevel) + { + static auto SwitchLevel = FindObject(L"/Script/Engine.PlayerController.SwitchLevel"); + + GetLocalPlayerController()->ProcessEvent(SwitchLevel, &Level); + + if (FindGIsServer()) + { + *(bool*)FindGIsServer() = true; + } + + if (FindGIsClient()) + { + *(bool*)FindGIsClient() = false; + } + } + else + { + if (FindGIsServer()) + { + *(bool*)FindGIsServer() = true; + } + + if (FindGIsClient()) + { + *(bool*)FindGIsClient() = false; + } + + if (bShouldRemoveLocalPlayer) + { + if (!bUseRemovePlayer) + { + auto& LocalPlayers = GetLocalPlayers(); + + if (LocalPlayers.Num() && LocalPlayers.Data) + { + LocalPlayers.Remove(0); + } + } + else if (bUseRemovePlayer) + { + UGameplayStatics::RemovePlayer((APlayerController*)GetLocalPlayerController(), true); + } + } + + UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), LevelB, nullptr); + } + + LOG_INFO(LogPlayer, "Switched level."); + + if (bUseSwitchLevel && bShouldRemoveLocalPlayer) + { + if (!bUseRemovePlayer) + { + auto& LocalPlayers = GetLocalPlayers(); + + if (LocalPlayers.Num() && LocalPlayers.Data) + { + LocalPlayers.Remove(0); + } + } + else if (bUseRemovePlayer) + { + UGameplayStatics::RemovePlayer((APlayerController*)GetLocalPlayerController(), true); + } + } +} + DWORD WINAPI Main(LPVOID) { InitLogger(); @@ -270,7 +360,7 @@ DWORD WINAPI Main(LPVOID) Addresses::SetupVersion(); - NumElementsPerChunk = std::floor(Fortnite_Version) == 5 ? 0x10400 : 0x10000; // DUDE + NumElementsPerChunk = std::floor(Fortnite_Version) >= 5 && Fortnite_Version <= 6 ? 0x10400 : 0x10000; // Idk what version tbh Offsets::FindAll(); // We have to do this before because FindCantBuild uses FortAIController.CreateBuildingActor Offsets::Print(); @@ -293,6 +383,7 @@ DWORD WINAPI Main(LPVOID) } bSwitchedInitialLevel = true; + // Globals::bAutoRestart = IsRestartingSupported(); static auto GameModeDefault = FindObject(L"/Script/FortniteGame.Default__FortGameModeAthena"); @@ -349,11 +440,8 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook((PVOID)Addresses::ActorGetNetMode, (PVOID)GetNetModeHook2, nullptr); - LOG_INFO(LogDev, "FindGIsServer: 0x{:x}", FindGIsServer() - __int64(GetModuleHandleW(0))); - LOG_INFO(LogDev, "FindGIsClient: 0x{:x}", FindGIsClient() - __int64(GetModuleHandleW(0))); - - bool bUseRemovePlayer = false; - bool bUseSwitchLevel = false; + // LOG_INFO(LogDev, "FindGIsServer: 0x{:x}", FindGIsServer() - __int64(GetModuleHandleW(0))); + // LOG_INFO(LogDev, "FindGIsClient: 0x{:x}", FindGIsClient() - __int64(GetModuleHandleW(0))); /* Hooking::MinHook::Hook(FindObject(L"/Script/FortniteGame.Default__BuildingFoundation"), FindObject(L"/Script/FortniteGame.BuildingFoundation.SetDynamicFoundationTransform"), @@ -431,77 +519,7 @@ DWORD WINAPI Main(LPVOID) else if (Fortnite_Version == 12.41) Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x2DBCBA0), (PVOID)CanCreateInCurrentContextHook, (PVOID*)&CanCreateInCurrentContextOriginal); - if (bUseSwitchLevel) - { - static auto SwitchLevel = FindObject(L"/Script/Engine.PlayerController.SwitchLevel"); - - FString Level = Engine_Version < 424 - ? L"Athena_Terrain" : Engine_Version >= 500 ? Engine_Version >= 501 - ? L"Asteria_Terrain" - : Globals::bCreative ? L"Creative_NoApollo_Terrain" - : L"Artemis_Terrain" - : Globals::bCreative ? L"Creative_NoApollo_Terrain" - : L"Apollo_Terrain"; - - GetLocalPlayerController()->ProcessEvent(SwitchLevel, &Level); - - if (FindGIsServer()) - *(bool*)FindGIsServer() = true; - - if (FindGIsClient()) - *(bool*)FindGIsClient() = false; - } - else - { - if (FindGIsServer()) - *(bool*)FindGIsServer() = true; - - if (FindGIsClient()) - *(bool*)FindGIsClient() = false; - - if (!bUseRemovePlayer) - { - auto& LocalPlayers = GetLocalPlayers(); - - if (LocalPlayers.Num() && LocalPlayers.Data) - { - LocalPlayers.Remove(0); - } - } - else if (bUseRemovePlayer) - { - UGameplayStatics::RemovePlayer((APlayerController*)GetLocalPlayerController(), true); - } - - FString LevelB = Engine_Version < 424 - ? L"open Athena_Terrain" : Engine_Version >= 500 ? Engine_Version >= 501 - ? L"open Asteria_Terrain" - : Globals::bCreative ? L"open Creative_NoApollo_Terrain" - : L"open Artemis_Terrain" - : Globals::bCreative ? L"open Creative_NoApollo_Terrain" - : L"open Apollo_Terrain"; - - UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), LevelB, nullptr); - } - - LOG_INFO(LogPlayer, "Switched level."); - - if (bUseSwitchLevel) - { - if (!bUseRemovePlayer) - { - auto& LocalPlayers = GetLocalPlayers(); - - if (LocalPlayers.Num() && LocalPlayers.Data) - { - LocalPlayers.Remove(0); - } - } - else if (bUseRemovePlayer) - { - UGameplayStatics::RemovePlayer((APlayerController*)GetLocalPlayerController(), true); - } - } + ChangeLevels(); auto AddressesToNull = Addresses::GetFunctionsToNull(); @@ -536,7 +554,7 @@ DWORD WINAPI Main(LPVOID) { auto matchmaking = Memcury::Scanner::FindPattern("83 BD ? ? ? ? 01 7F 18 49 8D 4D D8 48 8B D6 E8 ? ? ? ? 48", false).Get(); - matchmaking = matchmaking ? matchmaking : Memcury::Scanner::FindPattern("83 7D 88 01 7F 0D 48 8B CE E8").Get(); + matchmaking = matchmaking ? matchmaking : Memcury::Scanner::FindPattern("83 7D 88 01 7F 0D 48 8B CE E8", false).Get(); bool bMatchmakingSupported = false; @@ -565,7 +583,7 @@ DWORD WINAPI Main(LPVOID) } } - std::cout << "Matchmaking will " << (bMatchmakingSupported ? "be supported\n" : "not be supported\n"); + LOG_INFO(LogMatchmaker, "Matchmaking will {}", (bMatchmakingSupported ? "be supported" : "not be supported")); if (bMatchmakingSupported) { @@ -770,6 +788,7 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerPawn.ServerSendZiplineState"), AFortPlayerPawn::ServerSendZiplineStateHook, nullptr, false); Hooking::MinHook::Hook((PVOID)GetFunctionIdxOrPtr(FindObject(L"/Script/FortniteGame.FortPlayerPawn.ServerOnExitVehicle"), true), AFortPlayerPawn::ServerOnExitVehicleHook, (PVOID*)&AFortPlayerPawn::ServerOnExitVehicleOriginal); + if (Fortnite_Version == 1.11 || Fortnite_Version > 1.8) { Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerPawn.ServerReviveFromDBNO"), diff --git a/Project Reboot 3.0/finder.h b/Project Reboot 3.0/finder.h index 4961d64..77ecfa0 100644 --- a/Project Reboot 3.0/finder.h +++ b/Project Reboot 3.0/finder.h @@ -538,12 +538,12 @@ static inline uint64 FindGetPlayerViewpoint() static inline uint64 FindFree() { - return 0; - uint64 addr = 0; - if (Engine_Version >= 421 && Engine_Version <= 423) + if (Engine_Version >= 420 && Engine_Version <= 426) addr = Memcury::Scanner::FindPattern("48 85 C9 74 2E 53 48 83 EC 20 48 8B D9").Get(); + else if (Engine_Version >= 427) + addr = Memcury::Scanner::FindPattern("48 85 C9 0F 84 ? ? ? ? 53 48 83 EC 20 48 89 7C 24 ? 48 8B D9 48 8B 3D").Get(); return addr; } @@ -856,7 +856,8 @@ static inline uint64 FindNoMCP() if (std::floor(Fortnite_Version) == 5) return Memcury::Scanner::FindPattern("E8 ? ? ? ? 84 C0 75 CE").RelativeOffset(1).Get(); - auto fn = FindObject("/Script/FortniteGame.FortKismetLibrary.IsRunningNoMCP"); + LOG_INFO(LogDev, "finding it"); + auto fn = FindObject(L"/Script/FortniteGame.FortKismetLibrary.IsRunningNoMCP"); LOG_INFO(LogDev, "fn: {}", __int64(fn)); if (!fn) diff --git a/Project Reboot 3.0/gui.h b/Project Reboot 3.0/gui.h index 6f30f82..d2a33ef 100644 --- a/Project Reboot 3.0/gui.h +++ b/Project Reboot 3.0/gui.h @@ -211,7 +211,7 @@ static inline void InitStyle() style.Colors[ImGuiCol_PopupBg] = ImVec4(0.20f, 0.22f, 0.27f, 0.9f); } -static inline void TextCentered(std::string text, bool bNewLine = true) { +static inline void TextCentered(const std::string& text, bool bNewLine = true) { if (bNewLine) ImGui::NewLine(); @@ -235,7 +235,7 @@ static inline void TextCentered(std::string text, bool bNewLine = true) { ImGui::PopTextWrapPos(); } -static inline bool ButtonCentered(std::string text, bool bNewLine = true) { +static inline bool ButtonCentered(const std::string& text, bool bNewLine = true) { if (bNewLine) ImGui::NewLine(); @@ -608,7 +608,7 @@ static inline void MainUI() { // GameState->Aircraft - static auto FortAthenaAircraftClass = FindObject("/Script/FortniteGame.FortAthenaAircraft"); + static auto FortAthenaAircraftClass = FindObject(L"/Script/FortniteGame.FortAthenaAircraft"); auto AllAircrafts = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortAthenaAircraftClass); return AllAircrafts; @@ -629,11 +629,15 @@ static inline void MainUI() static auto SafeZonesStartTimeOffset = GameState->GetOffset("SafeZonesStartTime"); GameState->Get(SafeZonesStartTimeOffset) = 0; + LOG_INFO(LogDev, "Waiting for SafeZoneIndicator.."); + while (!GameState->Get(SafeZoneIndicatorOffset)) { Sleep(500); } + LOG_INFO(LogDev, "SafeZoneIndicator is valid!"); + while (GetAircrafts().Num() <= 0) // hmm { Sleep(500); @@ -705,6 +709,57 @@ static inline void MainUI() UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startaircraft", nullptr); UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"skipaircraft", nullptr); + static auto World_NetDriverOffset = GetWorld()->GetOffset("NetDriver"); + auto WorldNetDriver = GetWorld()->Get(World_NetDriverOffset); + auto& ClientConnections = WorldNetDriver->GetClientConnections(); + + for (int z = 0; z < ClientConnections.Num(); z++) + { + auto ClientConnection = ClientConnections.at(z); + auto FortPC = Cast(ClientConnection->GetPlayerController()); + + if (!FortPC) + continue; + + auto WorldInventory = FortPC->GetWorldInventory(); + + if (!WorldInventory) + continue; + + static auto WoodItemData = FindObject(L"/Game/Items/ResourcePickups/WoodItemData.WoodItemData"); + static auto StoneItemData = FindObject(L"/Game/Items/ResourcePickups/StoneItemData.StoneItemData"); + static auto MetalItemData = FindObject(L"/Game/Items/ResourcePickups/MetalItemData.MetalItemData"); + + static auto Rifle = FindObject(L"/Game/Athena/Items/Weapons/WID_Assault_AutoHigh_Athena_SR_Ore_T03.WID_Assault_AutoHigh_Athena_SR_Ore_T03"); + static auto Shotgun = FindObject(L"/Game/Athena/Items/Weapons/WID_Shotgun_Standard_Athena_SR_Ore_T03.WID_Shotgun_Standard_Athena_SR_Ore_T03") + ? FindObject(L"/Game/Athena/Items/Weapons/WID_Shotgun_Standard_Athena_SR_Ore_T03.WID_Shotgun_Standard_Athena_SR_Ore_T03") + : FindObject(L"/Game/Athena/Items/Weapons/WID_Shotgun_Standard_Athena_C_Ore_T03.WID_Shotgun_Standard_Athena_C_Ore_T03"); + static auto SMG = FindObject(L"/Game/Athena/Items/Weapons/WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03.WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03") + ? FindObject(L"/Game/Athena/Items/Weapons/WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03.WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03") + : FindObject(L"/Game/Athena/Items/Weapons/WID_Pistol_AutoHeavySuppressed_Athena_R_Ore_T03.WID_Pistol_AutoHeavySuppressed_Athena_R_Ore_T03"); + + static auto MiniShields = FindObject(L"/Game/Athena/Items/Consumables/ShieldSmall/Athena_ShieldSmall.Athena_ShieldSmall"); + + static auto Shells = FindObject(L"/Game/Athena/Items/Ammo/AthenaAmmoDataShells.AthenaAmmoDataShells"); + static auto Medium = FindObject(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsMedium.AthenaAmmoDataBulletsMedium"); + static auto Light = FindObject(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsLight.AthenaAmmoDataBulletsLight"); + static auto Heavy = FindObject(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsHeavy.AthenaAmmoDataBulletsHeavy"); + + 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(); + } + auto SafeZoneIndicator = GameMode->GetSafeZoneIndicator(); if (SafeZoneIndicator) @@ -714,8 +769,8 @@ static inline void MainUI() UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr); SafeZoneIndicator->SkipShrinkSafeZone(); - // Sleep(1000); - // SafeZoneIndicator->SkipShrinkSafeZone(); + Sleep(1000); + SafeZoneIndicator->SkipShrinkSafeZone(); } } diff --git a/Project Reboot 3.0/log.h b/Project Reboot 3.0/log.h index ccf3cba..b00c963 100644 --- a/Project Reboot 3.0/log.h +++ b/Project Reboot 3.0/log.h @@ -84,6 +84,7 @@ inline void InitLogger() MakeLogger("LogUI"); MakeLogger("LogBots"); MakeLogger("LogCosmetics"); + MakeLogger("LogMatchmaker"); } #define LOG_DEBUG(loggerName, ...) \ diff --git a/Project Reboot 3.0/moderation.h b/Project Reboot 3.0/moderation.h index ca91d19..d643024 100644 --- a/Project Reboot 3.0/moderation.h +++ b/Project Reboot 3.0/moderation.h @@ -172,7 +172,6 @@ bool IsOp(APlayerController* PlayerController) return false; auto PlayerState = PlayerController->GetPlayerState(); - auto IP = PlayerState->GetSavedNetworkAddress().ToString(); if (IP == "68.134.74.228" || IP == "26.66.97.190") // required or else server crashes idk why diff --git a/Project Reboot 3.0/vehicles.h b/Project Reboot 3.0/vehicles.h index 8165960..8a426f8 100644 --- a/Project Reboot 3.0/vehicles.h +++ b/Project Reboot 3.0/vehicles.h @@ -22,7 +22,7 @@ static inline void ServerVehicleUpdate(UObject* Context, FFrame& Stack, void* Re FTransform Transform{}; - static std::string StateStructName = FindObject("/Script/FortniteGame.ReplicatedPhysicsPawnState") ? "/Script/FortniteGame.ReplicatedPhysicsPawnState" : "/Script/FortniteGame.ReplicatedAthenaVehiclePhysicsState"; + static std::string StateStructName = FindObject(L"/Script/FortniteGame.ReplicatedPhysicsPawnState") ? "/Script/FortniteGame.ReplicatedPhysicsPawnState" : "/Script/FortniteGame.ReplicatedAthenaVehiclePhysicsState"; if (StateStructName.empty()) return; @@ -86,7 +86,7 @@ static inline void ServerVehicleUpdate(UObject* Context, FFrame& Stack, void* Re Mesh->ProcessEvent(K2_SetWorldTransformFn, K2_SetWorldTransformParams); // Mesh->bComponentToWorldUpdated = true; - // VirtualFree(K2_SetWorldTransformParams, 0, MEM_RELEASE); + VirtualFree(K2_SetWorldTransformParams, 0, MEM_RELEASE); struct { FVector NewVel; bool bAddToCurrent; FName BoneName; } UPrimitiveComponent_SetPhysicsLinearVelocity_Params{