Skip to content

Commit

Permalink
Merge pull request #52 from max8447/master
Browse files Browse the repository at this point in the history
Calendar Events tab and like more calendar events
  • Loading branch information
Milxnor authored Jan 15, 2024
2 parents 7002142 + b4ca8c9 commit af1fc0f
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 50 deletions.
4 changes: 2 additions & 2 deletions Project Reboot 3.0/GameModeBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
130 changes: 92 additions & 38 deletions Project Reboot 3.0/calendar.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@ 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()
{
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");

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<std::pair<float, float>> TimeAndValues = { { 0, 1.2f}, { 0.68104035f, 4.6893263f }, { 0.9632137f, 10.13335f }, { 1.0f, 15.0f } };
// 1.2
Expand All @@ -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<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;
}

static inline void SetSnow(float NewValue)
static inline void EnableFog()
{
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");
auto SnowSetup = GetSnowSetup();

LOG_INFO(LogDev, "SnowSetup: {}", SnowSetup->IsValidLowLevel() ? SnowSetup->GetFullName() : "BadRead");

if (SnowSetup && SetSnowFn)
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()};
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();

UFunction* OnReadyFunc = FindObject<UFunction>(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<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>("/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<int>(NewValue);

SnowSetup->ProcessEvent(SetSnowFn, &NewValue);

if (NewValue != -1 && Engine_Version >= 500)
{
auto UpdateSnowVisualsOnClientFn = FindObject<UFunction>("/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<float>(SnowAmountOffset) = NewValue;
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");

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);
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<UFunction>("/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetFallingSnow");
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, "Called SetSnow!");
LOG_INFO(LogDev, "NewYearTimer: {}", NewYearTimer->IsValidLowLevel() ? NewYearTimer->GetFullName() : "BadRead");

static auto ada = FindObject<UFunction>(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetFullSnowEd");
SnowSetup->ProcessEvent(ada);
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");

}
else
if (NewYearTimer && StartNYE)
{
LOG_INFO(LogDev, "Failed TO FIND!");
NewYearTimer->ProcessEvent(StartNYE, nullptr);
}
}
}
}
82 changes: 73 additions & 9 deletions Project Reboot 3.0/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
if (ImGui::Button("Start Safe Zone"))
Expand Down
3 changes: 2 additions & 1 deletion Project Reboot 3.0/vehicles.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ static inline void ServerVehicleUpdate(UObject* Context, FFrame& Stack, void* Re

static auto K2_SetWorldTransformFn = FindObject<UFunction>(L"/Script/Engine.SceneComponent.K2_SetWorldTransform");
static auto SetPhysicsLinearVelocityFn = FindObject<UFunction>(L"/Script/Engine.PrimitiveComponent.SetPhysicsLinearVelocity");
static auto SetPhysicsAngularVelocityFn = FindObject<UFunction>(L"/Script/Engine.PrimitiveComponent.SetPhysicsAngularVelocity");
static auto SetPhysicsAngularVelocityFn = FindObject<UFunction>(L"/Script/Engine.PrimitiveComponent.SetPhysicsAngularVelocity") ? FindObject<UFunction>(L"/Script/Engine.PrimitiveComponent.SetPhysicsAngularVelocity") :
FindObject<UFunction>(L"/Script/Engine.PrimitiveComponent.SetPhysicsAngularVelocityInDegrees");
static auto LinearVelocityOffset = FindOffsetStruct(StateStructName, "LinearVelocity");
static auto AngularVelocityOffset = FindOffsetStruct(StateStructName, "AngularVelocity");
static auto K2_SetWorldTransformParamSize = K2_SetWorldTransformFn->GetPropertiesSize();
Expand Down

0 comments on commit af1fc0f

Please sign in to comment.