Calendar Events tab and like more calendar events

This commit is contained in:
max_the
2024-01-15 18:51:47 +01:00
parent aacd99f4db
commit 61ff2ecef2
3 changed files with 174 additions and 56 deletions

View File

@@ -263,7 +263,7 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
static bool bFirst = true; static bool bFirst = true;
if (bFirst) if (bFirst && Calendar::HasSnowModification())
{ {
bFirst = false; bFirst = false;
Calendar::SetSnow(100); Calendar::SetSnow(100);

View File

@@ -8,7 +8,7 @@ namespace Calendar
{ {
static inline bool HasSnowModification() 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() static inline UObject* GetSnowSetup()
@@ -16,14 +16,16 @@ namespace Calendar
auto Class = FindObject<UClass>(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C") ? FindObject<UClass>(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C") : auto Class = FindObject<UClass>(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C") ? FindObject<UClass>(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C") :
FindObject<UClass>(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C"); FindObject<UClass>(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); 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() static inline float GetFullSnowMapValue()
{ {
if (Fortnite_Version == 7.30) if (Fortnite_Version == 7.10 || Fortnite_Version == 7.30)
{ {
std::vector<std::pair<float, float>> TimeAndValues = { { 0, 1.2f}, { 0.68104035f, 4.6893263f }, { 0.9632137f, 10.13335f }, { 1.0f, 15.0f } }; std::vector<std::pair<float, float>> TimeAndValues = { { 0, 1.2f}, { 0.68104035f, 4.6893263f }, { 0.9632137f, 10.13335f }, { 1.0f, 15.0f } };
// 1.2 // 1.2
@@ -32,73 +34,125 @@ namespace Calendar
// 15; // 15;
return TimeAndValues[3].first; return TimeAndValues[3].first;
} }
else if (Fortnite_Version == 11.31) else if (Fortnite_Version == 11.31 || Fortnite_Version == 15.10)
{ {
return 100; std::vector<std::pair<float, float>> 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<int> Values = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
return Values[6];
} }
return -1; return -1;
} }
static inline void EnableFog()
{
auto SnowSetup = GetSnowSetup();
if (SnowSetup)
{
static auto Onready1 = FindObject<UFunction>(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.OnReady_E426AA7F4F2319EA06FBA2B9905F0B24");
static auto Onready2 = FindObject<UFunction>(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.OnReady_0A511B314AE165C51798519FB84738B8");
static auto refrehsdmap = FindObject<UFunction>(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() };
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<UFunction>(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetSnowFall");
auto SnowSetup = GetSnowSetup();
if (SetSnowfallFn && SnowSetup)
{
SnowSetup->ProcessEvent(SetSnowfallFn, &NewValue);
}
}
static inline void SetSnow(float NewValue) static inline void SetSnow(float NewValue)
{ {
static auto SetSnowFn = FindObject<UFunction>(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetSnow") ? FindObject<UFunction>(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetSnow") : static auto SetSnowFn = FindObject<UFunction>(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetSnow") ? FindObject<UFunction>(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetSnow") :
FindObject<UFunction>(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C.SetSnow"); FindObject<UFunction>(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C.SetSnow") ? FindObject<UFunction>(L"/Game/Athena/Environments/Landscape/Blueprints/BP_SnowSetup.BP_SnowSetup_C.SetSnow") :
FindObject<UFunction>("/SpecialSurfaceCoverage/Items/BP_Artemis_S19Progression.BP_Artemis_S19Progression_C.SetSnowProgressionPhase");
auto SnowSetup = GetSnowSetup(); auto SnowSetup = GetSnowSetup();
LOG_INFO(LogDev, "SnowSetup: {}", SnowSetup->IsValidLowLevel() ? SnowSetup->GetFullName() : "BadRead"); LOG_INFO(LogDev, "SnowSetup: {}", SnowSetup->IsValidLowLevel() ? SnowSetup->GetFullName() : "BadRead");
if (SnowSetup && SetSnowFn) if (SnowSetup && SetSnowFn)
{ {
auto GameState = (AFortGameStateAthena*)GetWorld()->GetGameState(); if (Engine_Version >= 500)
NewValue = static_cast<int>(NewValue);
GET_PLAYLIST(GameState)
/*
struct { UObject* GameState; UObject* Playlist; FGameplayTagContainer PlaylistContextTags; } OnReadyParams{ GameState, CurrentPlaylist, FGameplayTagContainer()};
UFunction* OnReadyFunc = FindObject<UFunction>(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.OnReady_0A511B314AE165C51798519FB84738B8");
LOG_INFO(LogDev, "Calling OnReady!");
if (OnReadyFunc)
{
SnowSetup->ProcessEvent(OnReadyFunc, &OnReadyParams);
}
*/
LOG_INFO(LogDev, "Called OnReady!");
SnowSetup->ProcessEvent(SetSnowFn, &NewValue); SnowSetup->ProcessEvent(SetSnowFn, &NewValue);
LOG_INFO(LogDev, "Called SetSnow!"); if (NewValue != -1 && Engine_Version >= 500)
return;
if (NewValue != -1)
{ {
static auto SnowAmountOffset = SnowSetup->GetOffset("SnowAmount"); auto UpdateSnowVisualsOnClientFn = FindObject<UFunction>("/SpecialSurfaceCoverage/Items/BP_Artemis_S19Progression.BP_Artemis_S19Progression_C.UpdateSnowVisualsOnClient");
SnowSetup->Get<float>(SnowAmountOffset) = NewValue; SnowSetup->ProcessEvent(UpdateSnowVisualsOnClientFn);
static auto OnRep_Snow_AmountFn = FindObject<UFunction>("/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.OnRep_Snow_Amount");
SnowSetup->ProcessEvent(OnRep_Snow_AmountFn);
// SnowSetup->ProcessEvent(SetSnowFn, &NewValue);
} }
auto SetFallingSnowFn = FindObject<UFunction>("/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetFallingSnow");
LOG_INFO(LogDev, "Called SetSnow!"); LOG_INFO(LogDev, "Called SetSnow!");
static auto ada = FindObject<UFunction>(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetFullSnowEd");
SnowSetup->ProcessEvent(ada);
} }
else else
{ {
LOG_INFO(LogDev, "Failed TO FIND!"); LOG_INFO(LogDev, "Failed TO FIND!");
} }
} }
static inline void SetWaterLevel(int WaterLevel)
{
UObject* WL = FindObject("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.Apollo_WaterSetup_2");
if (WL && WaterLevel != -1)
{
static auto SetWaterLevel = FindObject<UFunction>("/Game/Athena/Apollo/Environments/Blueprints/Apollo_WaterSetup.Apollo_WaterSetup_C.SetWaterLevel");
static auto OnRep_CurrentWaterLevel = FindObject<UFunction>("/Game/Athena/Apollo/Environments/Blueprints/Apollo_WaterSetup.Apollo_WaterSetup_C.OnRep_CurrentWaterLevel");
WL->ProcessEvent(SetWaterLevel, &WaterLevel);
WL->ProcessEvent(OnRep_CurrentWaterLevel);
}
}
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;
}
static inline void StartNYE()
{
static auto NewYearTimer = FindObject<UObject>("/Game/Athena/Maps/Streaming/Athena_NYE_Celebration.Athena_NYE_Celebration.PersistentLevel.BP_NewYearTimer_2") ? FindObject<UObject>("/Game/Athena/Maps/Streaming/Athena_NYE_Celebration.Athena_NYE_Celebration.PersistentLevel.BP_NewYearTimer_2") :
FindObject<UObject>("/NewYears/Content/Levels/Apollo_NYE_Celebration.Apollo_NYE_Celebration.PersistentLevel.BP_NewYearTimer_2") ? FindObject<UObject>("/NewYears/Content/Levels/Apollo_NYE_Celebration.Apollo_NYE_Celebration.PersistentLevel.BP_NewYearTimer_2") :
FindObject<UObject>("/NewYears/Content/Levels/Artemis_NYE_Celebration.Artemis_NYE_Celebration.PersistentLevel.BP_NewYearTimer_2");
LOG_INFO(LogDev, "NewYearTimer: {}", NewYearTimer->IsValidLowLevel() ? NewYearTimer->GetFullName() : "BadRead");
static auto StartNYE = FindObject<UFunction>("/Game/Athena/Events/NewYear/BP_NewYearTimer.BP_NewYearTimer_C.startNYE") ? FindObject<UFunction>("/Game/Athena/Events/NewYear/BP_NewYearTimer.BP_NewYearTimer_C.startNYE") :
FindObject<UFunction>("/NewYears/Blueprints/BP_NewYearTimer.BP_NewYearTimer_C.startNYE");
LOG_INFO(LogDev, "StartNYE: {}", StartNYE->IsValidLowLevel() ? StartNYE->GetFullName() : "BadRead");
if (NewYearTimer && StartNYE)
{
NewYearTimer->ProcessEvent(StartNYE, nullptr);
}
}
} }

View File

@@ -42,21 +42,23 @@
#include "BGA.h" #include "BGA.h"
#include "vendingmachine.h" #include "vendingmachine.h"
#include "die.h" #include "die.h"
#include "calendar.h"
#define GAME_TAB 1 #define GAME_TAB 1
#define PLAYERS_TAB 2 #define PLAYERS_TAB 2
#define GAMEMODE_TAB 3 #define GAMEMODE_TAB 3
#define THANOS_TAB 4 #define THANOS_TAB 4
#define EVENT_TAB 5 #define EVENT_TAB 5
#define ZONE_TAB 6 #define CALENDAR_TAB 6
#define DUMP_TAB 7 #define ZONE_TAB 7
#define UNBAN_TAB 8 #define DUMP_TAB 8
#define FUN_TAB 9 #define UNBAN_TAB 9
#define LATEGAME_TAB 10 #define FUN_TAB 10
#define DEVELOPER_TAB 11 #define LATEGAME_TAB 11
#define DEBUGLOG_TAB 12 #define DEVELOPER_TAB 12
#define SETTINGS_TAB 13 #define DEBUGLOG_TAB 13
#define CREDITS_TAB 14 #define SETTINGS_TAB 14
#define CREDITS_TAB 15
#define MAIN_PLAYERTAB 1 #define MAIN_PLAYERTAB 1
#define INVENTORY_PLAYERTAB 2 #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"))) if (ImGui::BeginTabItem(("Zone")))
{ {
Tab = ZONE_TAB; 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<int>(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) else if (Tab == ZONE_TAB)
{ {
if (ImGui::Button("Start Safe Zone")) if (ImGui::Button("Start Safe Zone"))