diff --git a/Project Reboot 3.0/Array.h b/Project Reboot 3.0/Array.h index 92cf406..a04a97d 100644 --- a/Project Reboot 3.0/Array.h +++ b/Project Reboot 3.0/Array.h @@ -412,4 +412,9 @@ public: return false; } + + inline InElementType& operator[](uint32 Index) + { + return Data[Index]; + } }; \ No newline at end of file diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index 1eda51f..1c21b15 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -35,6 +35,8 @@ #include "calendar.h" #include "gui.h" #include +#include "TSubclassOf.h" +#include "FortAthenaSupplyDrop.h" static UFortPlaylistAthena* GetPlaylistToUse() { @@ -188,6 +190,58 @@ void AFortGameModeAthena::StartAircraftPhase() } } +void AFortGameModeAthena::OverrideBattleBus(AFortGameStateAthena* GameState, UObject* OverrideBattleBusSkin) +{ + if (!OverrideBattleBusSkin) + { + LOG_WARN(LogGame, "OverrideBattleBus not found! Equipping default battle bus."); + return; + } + + 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; + } + } +} + +void AFortGameModeAthena::OverrideSupplyDrop(AFortGameStateAthena* GameState, UClass* OverrideSupplyDropBusClass) +{ + if (!OverrideSupplyDropBusClass) + { + LOG_WARN(LogGame, "OverrideSuppyDrop not found! Equipping default supply drop."); + return; + } + + static auto MapInfoOffset = GameState->GetOffset("MapInfo"); + auto MapInfo = GameState->Get(MapInfoOffset); + + static auto SupplyDropInfoListOffset = MapInfo->GetOffset("SupplyDropInfoList"); + auto SupplyDropInfoList = MapInfo->Get>(SupplyDropInfoListOffset); + + static auto SupplyDropClassOffset = SupplyDropInfoList[0]->GetOffset("SupplyDropClass"); + SupplyDropInfoList[0]->Get>(SupplyDropClassOffset) = OverrideSupplyDropBusClass; + + LOG_INFO(LogGame, "Overridden SupplyDropClass: {}", OverrideSupplyDropBusClass->GetFullName()); +} + void AFortGameModeAthena::PauseSafeZone(bool bPaused) { auto GameState = GetGameStateAthena(); @@ -1145,6 +1199,39 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena } } + static auto BGAClass = FindObject(L"/Script/Engine.BlueprintGeneratedClass"); + static UObject* OverrideBattleBusSkin = nullptr; + static UClass* OverrideSupplyDropClass = LoadObject(L"/Game/Athena/SupplyDrops/AthenaSupplyDrop.AthenaSupplyDrop_C", BGAClass); + + if (Fortnite_Version == 1.11 || Fortnite_Version == 7.30 || Fortnite_Version == 11.31 || Fortnite_Version == 15.10 || Fortnite_Version == 19.10) + { + OverrideBattleBusSkin = FindObject(L"/Game/Athena/Items/Cosmetics/BattleBuses/BBID_WinterBus.BBID_WinterBus"); // Winterfest + OverrideSupplyDropClass = LoadObject(L"/Game/Athena/SupplyDrops/AthenaSupplyDrop_Holiday.AthenaSupplyDrop_Holiday_C", BGAClass); + } + else if (Fortnite_Version == 5.10 || Fortnite_Version == 9.41 || Fortnite_Version == 14.20 || Fortnite_Version == 18.00) + { + OverrideBattleBusSkin = FindObject(L"/Game/Athena/Items/Cosmetics/BattleBuses/BBID_BirthdayBus2nd.BBID_BirthdayBus2nd"); // Birthday + OverrideSupplyDropClass = LoadObject(L"/Game/Athena/SupplyDrops/AthenaSupplyDrop_BDay.AthenaSupplyDrop_BDay_C", BGAClass); + } + else if (Fortnite_Version == 1.8 || Fortnite_Version == 6.20 || Fortnite_Version == 6.21 || Fortnite_Version == 11.10 || Fortnite_Version == 14.40 || Fortnite_Version == 18.21) + { + OverrideBattleBusSkin = FindObject(L"/Game/Athena/Items/Cosmetics/BattleBuses/BBID_HalloweenBus.BBID_HalloweenBus"); // Fortnitemares + } + else if (Fortnite_Version >= 12.30 && Fortnite_Version <= 12.61) + { + OverrideBattleBusSkin = FindObject(L"/Game/Athena/Items/Cosmetics/BattleBuses/BBID_DonutBus.BBID_DonutBus"); // Deadpool + OverrideSupplyDropClass = LoadObject(L"/Game/Athena/SupplyDrops/AthenaSupplyDrop_Donut.AthenaSupplyDrop_Donut_C", BGAClass); + } + else if (Fortnite_Version == 9.30) + { + OverrideBattleBusSkin = FindObject(L"/Game/Athena/Items/Cosmetics/BattleBuses/BBID_WorldCupBus.BBID_WorldCupBus"); // World Cup + } + + if (OverrideBattleBusSkin) + OverrideBattleBus(GameState, OverrideBattleBusSkin); + + OverrideSupplyDrop(GameState, OverrideSupplyDropClass); + // if (Engine_Version < 427) { static int LastNum69 = 19451; diff --git a/Project Reboot 3.0/FortGameModeAthena.h b/Project Reboot 3.0/FortGameModeAthena.h index b78792f..dd3303f 100644 --- a/Project Reboot 3.0/FortGameModeAthena.h +++ b/Project Reboot 3.0/FortGameModeAthena.h @@ -232,6 +232,11 @@ static void StreamLevel(const std::string& LevelName, FVector Location = {}) ShowFoundation(BuildingFoundation); } +class UFortSupplyDropInfo : public UObject // UDataAsset +{ +public: +}; + class AFortGameModeAthena : public AFortGameModePvPBase { public: @@ -269,6 +274,8 @@ public: void PauseSafeZone(bool bPaused = true); void StartAircraftPhase(); + static void OverrideBattleBus(AFortGameStateAthena* GameState, UObject* OverrideBattleBusSkin); + static void OverrideSupplyDrop(AFortGameStateAthena* GameState, UClass* OverrideSupplyDropBusClass); static void HandleSpawnRateForActorClass(UClass* ActorClass, float SpawnPercentage); // idk where to put static void OnAircraftEnteredDropZoneHook(AFortGameModeAthena* GameModeAthena, AActor* Aircraft); diff --git a/Project Reboot 3.0/Project Reboot 3.0.vcxproj b/Project Reboot 3.0/Project Reboot 3.0.vcxproj index 422c1cb..66aa25e 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj @@ -471,6 +471,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 62285ea..0ce45da 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters @@ -960,6 +960,9 @@ FortniteGame\Source\FortniteGame\Public + + Engine\Source\Runtime\Engine\Classes\Engine + diff --git a/Project Reboot 3.0/TSubclassOf.h b/Project Reboot 3.0/TSubclassOf.h new file mode 100644 index 0000000..dcbf8ef --- /dev/null +++ b/Project Reboot 3.0/TSubclassOf.h @@ -0,0 +1,63 @@ +#pragma once + +template +class TSubclassOf +{ + class UClass* ClassPtr; + +public: + TSubclassOf() = default; + + inline TSubclassOf(UClass* Class) + : ClassPtr(Class) + { + } + + inline UClass* Get() + { + return ClassPtr; + } + + inline operator UClass* () const + { + return ClassPtr; + } + + template, bool>::type> + inline operator TSubclassOf() const + { + return ClassPtr; + } + + inline UClass* operator->() + { + return ClassPtr; + } + + inline TSubclassOf& operator=(UClass* Class) + { + ClassPtr = Class; + + return *this; + } + + inline bool operator==(const TSubclassOf& Other) const + { + return ClassPtr == Other.ClassPtr; + } + + inline bool operator!=(const TSubclassOf& Other) const + { + return ClassPtr != Other.ClassPtr; + } + + inline bool operator==(UClass* Other) const + { + return ClassPtr == Other; + } + + inline bool operator!=(UClass* Other) const + { + return ClassPtr != Other; + } +}; \ No newline at end of file diff --git a/Project Reboot 3.0/gui.h b/Project Reboot 3.0/gui.h index cc57bb3..a0eb440 100644 --- a/Project Reboot 3.0/gui.h +++ b/Project Reboot 3.0/gui.h @@ -819,54 +819,7 @@ static inline void MainUI() auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode(); auto GameState = Cast(GameMode->GetGameState()); - AmountOfPlayersWhenBusStart = GameState->GetPlayersLeft(); // scuffed!!!! - - if (Fortnite_Version == 1.11) - { - static auto OverrideBattleBusSkin = FindObject(L"/Game/Athena/Items/Cosmetics/BattleBuses/BBID_WinterBus.BBID_WinterBus"); - LOG_INFO(LogDev, "OverrideBattleBusSkin: {}", __int64(OverrideBattleBusSkin)); - - if (OverrideBattleBusSkin) - { - static auto AssetManagerOffset = GetEngine()->GetOffset("AssetManager"); - auto AssetManager = GetEngine()->Get(AssetManagerOffset); - - if (AssetManager) - { - 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; - } - } - } - } + AmountOfPlayersWhenBusStart = GameState->GetPlayersLeft(); static auto WarmupCountdownEndTimeOffset = GameState->GetOffset("WarmupCountdownEndTime"); // GameState->Get(WarmupCountdownEndTimeOffset) = UGameplayStatics::GetTimeSeconds(GetWorld()) + 10;