From 61ff2ecef29672e597e51924941d075ffff6610f Mon Sep 17 00:00:00 2001 From: max_the Date: Mon, 15 Jan 2024 18:51:47 +0100 Subject: [PATCH 1/2] Calendar Events tab and like more calendar events --- Project Reboot 3.0/GameModeBase.cpp | 4 +- Project Reboot 3.0/calendar.h | 130 ++++++++++++++++++++-------- Project Reboot 3.0/gui.h | 82 ++++++++++++++++-- 3 files changed, 167 insertions(+), 49 deletions(-) diff --git a/Project Reboot 3.0/GameModeBase.cpp b/Project Reboot 3.0/GameModeBase.cpp index af2aba9..a4d1521 100644 --- a/Project Reboot 3.0/GameModeBase.cpp +++ b/Project Reboot 3.0/GameModeBase.cpp @@ -261,9 +261,9 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll // NewPlayerAsAthena->RespawnPlayerAfterDeath(true); } - static bool bFirst = true; + static bool bFirst = true; - if (bFirst) + if (bFirst && Calendar::HasSnowModification()) { bFirst = false; Calendar::SetSnow(100); diff --git a/Project Reboot 3.0/calendar.h b/Project Reboot 3.0/calendar.h index c82c763..1bdb372 100644 --- a/Project Reboot 3.0/calendar.h +++ b/Project Reboot 3.0/calendar.h @@ -8,7 +8,7 @@ namespace Calendar { static inline bool HasSnowModification() { - return Fortnite_Version == 7.30 || Fortnite_Version == 11.31 || Fortnite_Version == 15.10 || Fortnite_Version == 19.10; + return Fortnite_Version == 7.10 || Fortnite_Version == 7.30 || Fortnite_Version == 11.31 || Fortnite_Version == 15.10 || Fortnite_Version == 19.01 || Fortnite_Version == 19.10; } static inline UObject* GetSnowSetup() @@ -16,14 +16,16 @@ namespace Calendar auto Class = FindObject(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C") ? FindObject(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C") : FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C"); + auto S19Class = FindObject(L"/SpecialSurfaceCoverage/Maps/SpecialSurfaceCoverage_Artemis_Terrain_LS_Parent_Overlay.SpecialSurfaceCoverage_Artemis_Terrain_LS_Parent_Overlay.PersistentLevel.BP_Artemis_S19Progression_C_0"); + auto Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), Class); - return Actors.Num() > 0 ? Actors.at(0) : nullptr; + return Actors.Num() > 0 ? Actors.at(0) : S19Class ? S19Class : nullptr; } static inline float GetFullSnowMapValue() { - if (Fortnite_Version == 7.30) + if (Fortnite_Version == 7.10 || Fortnite_Version == 7.30) { std::vector> TimeAndValues = { { 0, 1.2f}, { 0.68104035f, 4.6893263f }, { 0.9632137f, 10.13335f }, { 1.0f, 15.0f } }; // 1.2 @@ -32,73 +34,125 @@ namespace Calendar // 15; return TimeAndValues[3].first; } - else if (Fortnite_Version == 11.31) + else if (Fortnite_Version == 11.31 || Fortnite_Version == 15.10) { - return 100; + std::vector> TimeAndValues = { { 0, 0.0f }, { 0.5f, 0.35f }, { 0.75f, 0.5f }, { 1.0f, 1.0f } }; + // 0 + // 0.35 + // 0.5 + // 1 + return TimeAndValues[3].first; + } + else if (Fortnite_Version == 19.01 || Fortnite_Version == 19.10) + { + std::vector Values = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; + + return Values[6]; } return -1; } - static inline void SetSnow(float NewValue) + static inline void EnableFog() { - static auto SetSnowFn = FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetSnow") ? FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetSnow") : - FindObject(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C.SetSnow"); auto SnowSetup = GetSnowSetup(); - LOG_INFO(LogDev, "SnowSetup: {}", SnowSetup->IsValidLowLevel() ? SnowSetup->GetFullName() : "BadRead"); - - if (SnowSetup && SetSnowFn) + if (SnowSetup) { + static auto Onready1 = FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.OnReady_E426AA7F4F2319EA06FBA2B9905F0B24"); + static auto Onready2 = FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.OnReady_0A511B314AE165C51798519FB84738B8"); + static auto refrehsdmap = FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C:RefreshMapLocations"); + auto GameState = (AFortGameStateAthena*)GetWorld()->GetGameState(); GET_PLAYLIST(GameState) - /* - struct { UObject* GameState; UObject* Playlist; FGameplayTagContainer PlaylistContextTags; } OnReadyParams{ GameState, CurrentPlaylist, FGameplayTagContainer()}; + struct { UObject* GameState; UObject* Playlist; FGameplayTagContainer PlaylistContextTags; } OnReadyParams{ GameState, CurrentPlaylist, FGameplayTagContainer() }; + + SnowSetup->ProcessEvent(Onready1, &OnReadyParams); + SnowSetup->ProcessEvent(Onready2, &OnReadyParams); + SnowSetup->ProcessEvent(refrehsdmap); // needed? + } + } + + static inline void SetSnowfall(float NewValue) // idk bruh i think setsnow also does this math things who knows + { + static auto SetSnowfallFn = FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetSnowFall"); + auto SnowSetup = GetSnowSetup(); - UFunction* OnReadyFunc = FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.OnReady_0A511B314AE165C51798519FB84738B8"); + if (SetSnowfallFn && SnowSetup) + { + SnowSetup->ProcessEvent(SetSnowfallFn, &NewValue); + } + } - LOG_INFO(LogDev, "Calling OnReady!"); + static inline void SetSnow(float NewValue) + { - if (OnReadyFunc) - { - SnowSetup->ProcessEvent(OnReadyFunc, &OnReadyParams); - } + static auto SetSnowFn = FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetSnow") ? FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetSnow") : + FindObject(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C.SetSnow") ? FindObject(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C.SetSnow") : + FindObject("/SpecialSurfaceCoverage/Items/BP_Artemis_S19Progression.BP_Artemis_S19Progression_C.SetSnowProgressionPhase"); + + auto SnowSetup = GetSnowSetup(); - */ + LOG_INFO(LogDev, "SnowSetup: {}", SnowSetup->IsValidLowLevel() ? SnowSetup->GetFullName() : "BadRead"); - LOG_INFO(LogDev, "Called OnReady!"); + if (SnowSetup && SetSnowFn) + { + if (Engine_Version >= 500) + NewValue = static_cast(NewValue); SnowSetup->ProcessEvent(SetSnowFn, &NewValue); + if (NewValue != -1 && Engine_Version >= 500) + { + auto UpdateSnowVisualsOnClientFn = FindObject("/SpecialSurfaceCoverage/Items/BP_Artemis_S19Progression.BP_Artemis_S19Progression_C.UpdateSnowVisualsOnClient"); + SnowSetup->ProcessEvent(UpdateSnowVisualsOnClientFn); + } + LOG_INFO(LogDev, "Called SetSnow!"); + } + else + { + LOG_INFO(LogDev, "Failed TO FIND!"); + } + } - return; + static inline void SetWaterLevel(int WaterLevel) + { + UObject* WL = FindObject("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.Apollo_WaterSetup_2"); - if (NewValue != -1) - { - static auto SnowAmountOffset = SnowSetup->GetOffset("SnowAmount"); - SnowSetup->Get(SnowAmountOffset) = NewValue; + if (WL && WaterLevel != -1) + { + static auto SetWaterLevel = FindObject("/Game/Athena/Apollo/Environments/Blueprints/Apollo_WaterSetup.Apollo_WaterSetup_C.SetWaterLevel"); + static auto OnRep_CurrentWaterLevel = FindObject("/Game/Athena/Apollo/Environments/Blueprints/Apollo_WaterSetup.Apollo_WaterSetup_C.OnRep_CurrentWaterLevel"); - static auto OnRep_Snow_AmountFn = FindObject("/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.OnRep_Snow_Amount"); - SnowSetup->ProcessEvent(OnRep_Snow_AmountFn); + WL->ProcessEvent(SetWaterLevel, &WaterLevel); + WL->ProcessEvent(OnRep_CurrentWaterLevel); + } + } - // SnowSetup->ProcessEvent(SetSnowFn, &NewValue); - } + static inline bool HasNYE() + { + return Fortnite_Version == 7.10 || Fortnite_Version == 11.31 || Fortnite_Version == 15.10 || Fortnite_Version == 19.00 || Fortnite_Version == 19.01; + } - auto SetFallingSnowFn = FindObject("/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetFallingSnow"); + static inline void StartNYE() + { + static auto NewYearTimer = FindObject("/Game/Athena/Maps/Streaming/Athena_NYE_Celebration.Athena_NYE_Celebration.PersistentLevel.BP_NewYearTimer_2") ? FindObject("/Game/Athena/Maps/Streaming/Athena_NYE_Celebration.Athena_NYE_Celebration.PersistentLevel.BP_NewYearTimer_2") : + FindObject("/NewYears/Content/Levels/Apollo_NYE_Celebration.Apollo_NYE_Celebration.PersistentLevel.BP_NewYearTimer_2") ? FindObject("/NewYears/Content/Levels/Apollo_NYE_Celebration.Apollo_NYE_Celebration.PersistentLevel.BP_NewYearTimer_2") : + FindObject("/NewYears/Content/Levels/Artemis_NYE_Celebration.Artemis_NYE_Celebration.PersistentLevel.BP_NewYearTimer_2"); - LOG_INFO(LogDev, "Called SetSnow!"); + LOG_INFO(LogDev, "NewYearTimer: {}", NewYearTimer->IsValidLowLevel() ? NewYearTimer->GetFullName() : "BadRead"); - static auto ada = FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetFullSnowEd"); - SnowSetup->ProcessEvent(ada); + static auto StartNYE = FindObject("/Game/Athena/Events/NewYear/BP_NewYearTimer.BP_NewYearTimer_C.startNYE") ? FindObject("/Game/Athena/Events/NewYear/BP_NewYearTimer.BP_NewYearTimer_C.startNYE") : + FindObject("/NewYears/Blueprints/BP_NewYearTimer.BP_NewYearTimer_C.startNYE"); + LOG_INFO(LogDev, "StartNYE: {}", StartNYE->IsValidLowLevel() ? StartNYE->GetFullName() : "BadRead"); - } - else + if (NewYearTimer && StartNYE) { - LOG_INFO(LogDev, "Failed TO FIND!"); + NewYearTimer->ProcessEvent(StartNYE, nullptr); } } -} +} \ No newline at end of file diff --git a/Project Reboot 3.0/gui.h b/Project Reboot 3.0/gui.h index 17e3af8..cc57bb3 100644 --- a/Project Reboot 3.0/gui.h +++ b/Project Reboot 3.0/gui.h @@ -42,21 +42,23 @@ #include "BGA.h" #include "vendingmachine.h" #include "die.h" +#include "calendar.h" #define GAME_TAB 1 #define PLAYERS_TAB 2 #define GAMEMODE_TAB 3 #define THANOS_TAB 4 #define EVENT_TAB 5 -#define ZONE_TAB 6 -#define DUMP_TAB 7 -#define UNBAN_TAB 8 -#define FUN_TAB 9 -#define LATEGAME_TAB 10 -#define DEVELOPER_TAB 11 -#define DEBUGLOG_TAB 12 -#define SETTINGS_TAB 13 -#define CREDITS_TAB 14 +#define CALENDAR_TAB 6 +#define ZONE_TAB 7 +#define DUMP_TAB 8 +#define UNBAN_TAB 9 +#define FUN_TAB 10 +#define LATEGAME_TAB 11 +#define DEVELOPER_TAB 12 +#define DEBUGLOG_TAB 13 +#define SETTINGS_TAB 14 +#define CREDITS_TAB 15 #define MAIN_PLAYERTAB 1 #define INVENTORY_PLAYERTAB 2 @@ -376,6 +378,14 @@ static inline void MainTabs() } } + if (ImGui::BeginTabItem("Calendar Events")) + { + Tab = CALENDAR_TAB; + PlayerTab = -1; + bInformationTab = false; + ImGui::EndTabItem(); + } + if (ImGui::BeginTabItem(("Zone"))) { Tab = ZONE_TAB; @@ -911,6 +921,60 @@ static inline void MainUI() } } + else if (Tab == CALENDAR_TAB) + { + if (Calendar::HasSnowModification()) + { + static bool bFirst = false; + + static float FullSnowValue = Calendar::GetFullSnowMapValue(); + static float NoSnowValue = 0.0f; + static float SnowValue = 0.0f; + + ImGui::SliderFloat(("Snow Level"), &SnowValue, 0, FullSnowValue); + + if (ImGui::Button("Set Snow Level")) + { + Calendar::SetSnow(SnowValue); + } + + if (ImGui::Button("Toggle Full Snow Map")) + { + bFirst ? Calendar::SetSnow(NoSnowValue) : Calendar::SetSnow(FullSnowValue); + + bFirst = !bFirst; + } + } + + if (Calendar::HasNYE()) + { + if (ImGui::Button("Start New Years Eve Event")) + { + Calendar::StartNYE(); + } + } + + if (std::floor(Fortnite_Version) == 13) + { + static UObject* WL = FindObject("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.Apollo_WaterSetup_2"); + + if (WL) + { + static auto MaxWaterLevelOffset = WL->GetOffset("MaxWaterLevel"); + + static int MaxWaterLevel = WL->Get(MaxWaterLevelOffset); + static int WaterLevel = 0; + + ImGui::SliderInt("WaterLevel", &WaterLevel, 0, MaxWaterLevel); + + if (ImGui::Button("Set Water Level")) + { + Calendar::SetWaterLevel(WaterLevel); + } + } + } + } + else if (Tab == ZONE_TAB) { if (ImGui::Button("Start Safe Zone")) From b4ca8c9bfe669f5288f970825f2a901072a7e6b2 Mon Sep 17 00:00:00 2001 From: max_the Date: Mon, 15 Jan 2024 19:51:22 +0100 Subject: [PATCH 2/2] fix crashing when enter vehicle on s19+ i think --- Project Reboot 3.0/vehicles.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Project Reboot 3.0/vehicles.h b/Project Reboot 3.0/vehicles.h index 8a426f8..0f40c7f 100644 --- a/Project Reboot 3.0/vehicles.h +++ b/Project Reboot 3.0/vehicles.h @@ -66,7 +66,8 @@ static inline void ServerVehicleUpdate(UObject* Context, FFrame& Stack, void* Re static auto K2_SetWorldTransformFn = FindObject(L"/Script/Engine.SceneComponent.K2_SetWorldTransform"); static auto SetPhysicsLinearVelocityFn = FindObject(L"/Script/Engine.PrimitiveComponent.SetPhysicsLinearVelocity"); - static auto SetPhysicsAngularVelocityFn = FindObject(L"/Script/Engine.PrimitiveComponent.SetPhysicsAngularVelocity"); + static auto SetPhysicsAngularVelocityFn = FindObject(L"/Script/Engine.PrimitiveComponent.SetPhysicsAngularVelocity") ? FindObject(L"/Script/Engine.PrimitiveComponent.SetPhysicsAngularVelocity") : + FindObject(L"/Script/Engine.PrimitiveComponent.SetPhysicsAngularVelocityInDegrees"); static auto LinearVelocityOffset = FindOffsetStruct(StateStructName, "LinearVelocity"); static auto AngularVelocityOffset = FindOffsetStruct(StateStructName, "AngularVelocity"); static auto K2_SetWorldTransformParamSize = K2_SetWorldTransformFn->GetPropertiesSize();