pretty bountiful update

fix some crash on inject, add auto restart, add webhook, fix foundations being scuffy on some higher versions.
This commit is contained in:
Milxnor
2023-05-01 20:27:11 -04:00
parent 02717f33f3
commit f4c12fd7f5
20 changed files with 5500 additions and 14 deletions

View File

@@ -15,6 +15,7 @@
#include "DataTableFunctionLibrary.h"
#include "KismetStringLibrary.h"
#include "SoftObjectPtr.h"
#include "discord.h"
#include "vehicles.h"
#include "globals.h"
@@ -558,19 +559,27 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
// return false;
static auto NewFn = FindObject<UFunction>("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C.New");
if (NewFn && (Fortnite_Version == 5.30 ? !Globals::bGoingToPlayEvent : true))
if (!UptimeWebHook.send_message(std::format("Server up! {} {}", Fortnite_Version, PlaylistName))) // PlaylistName sometimes isn't always what we use.
{
auto Loader = GetEventLoader("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C");
// Sleep(-1); // what why did i have this here i honestly forgot
}
LOG_INFO(LogDev, "Loader: {}", __int64(Loader));
if (std::floor(Fortnite_Version) == 5)
{
auto NewFn = FindObject<UFunction>("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C.New");
if (Loader)
if (NewFn && (Fortnite_Version == 5.30 ? !Globals::bGoingToPlayEvent : true))
{
int32 NewParam = 1;
// Loader->ProcessEvent(NextFn, &NewParam);
Loader->ProcessEvent(NewFn, &NewParam);
auto Loader = GetEventLoader("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C");
LOG_INFO(LogDev, "Loader: {}", __int64(Loader));
if (Loader)
{
int32 NewParam = 1;
// Loader->ProcessEvent(NextFn, &NewParam);
Loader->ProcessEvent(NewFn, &NewParam);
}
}
}

View File

@@ -1097,6 +1097,8 @@ DWORD WINAPI RestartThread(LPVOID)
float SecondsBeforeRestart = 10;
Sleep(SecondsBeforeRestart * 1000);
LOG_INFO(LogDev, "Auto restarting!");
Restart();
bIsInAutoRestart = false;
@@ -1351,10 +1353,27 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
}
}
LOG_INFO(LogDev, "KillerPlayerState->Place: {}", KillerPlayerState ? KillerPlayerState->GetPlace() : -1);
// LOG_INFO(LogDev, "KillerPlayerState->Place: {}", KillerPlayerState ? KillerPlayerState->GetPlace() : -1);
bool bDidSomeoneWin = false;
// wtf
auto AllPlayerStates = UGameplayStatics::GetAllActorsOfClass(GetWorld(), AFortPlayerStateAthena::StaticClass());
for (int i = 0; i < AllPlayerStates.Num(); i++)
{
if (((AFortPlayerStateAthena*)AllPlayerStates.at(i))->GetPlace() <= 1)
{
bDidSomeoneWin = true;
break;
}
}
LOG_INFO(LogDev, "bDidSomeoneWin: {}", bDidSomeoneWin);
// if (GameState->GetGamePhase() == EAthenaGamePhase::EndGame)
if (false)
if (bDidSomeoneWin)
{
CreateThread(0, 0, RestartThread, 0, 0, 0);
}

View File

@@ -160,7 +160,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalLibraryDirectories>../vendor</AdditionalLibraryDirectories>
<AdditionalDependencies>Oleaut32.lib;Onecore.lib;MinHook/minhook.x64.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>curl/libcurl.lib;curl/zlib.lib;Oleaut32.lib;Onecore.lib;MinHook/minhook.x64.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
@@ -297,6 +297,7 @@
<ClInclude Include="DelegateCombinations.h" />
<ClInclude Include="DelegateInstanceInterface.h" />
<ClInclude Include="die.h" />
<ClInclude Include="discord.h" />
<ClInclude Include="EnableIf.h" />
<ClInclude Include="Engine.h" />
<ClInclude Include="EngineTypes.h" />

View File

@@ -841,6 +841,7 @@
<ClInclude Include="FortAthenaMutator_LoadoutSwap.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="discord.h" />
</ItemGroup>
<ItemGroup>
<Filter Include="Engine">

View File

@@ -465,6 +465,11 @@ std::vector<uint64> Addresses::GetFunctionsToNull()
{
std::vector<uint64> toNull;
if (Engine_Version == 416)
{
toNull.push_back(Memcury::Scanner::FindPattern("48 89 54 24 ? 48 89 4C 24 ? 55 53 57 48 8D 6C 24 ? 48 81 EC ? ? ? ? 8B 41 08 C1 E8 05").Get()); // Widget class
}
if (Fortnite_Version == 1.11)
{
toNull.push_back(Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 57 41 56 41 57 48 81 EC ? ? ? ? 48 8B 01 49 8B E9 45 0F B6 F8").Get()); // No Reserve
@@ -487,6 +492,11 @@ std::vector<uint64> Addresses::GetFunctionsToNull()
toNull.push_back(Memcury::Scanner::FindStringRef(L"Widget Class %s - Running Initialize On Archetype, %s.").ScanFor({ 0x40, 0x55 }, false).Get()); // Widget class
}
if (Engine_Version == 421)
{
toNull.push_back(Memcury::Scanner::FindStringRef(L"Widget Class %s - Running Initialize On Archetype, %s.").ScanFor({ 0x40, 0x55 }, false).Get()); // Widget class
}
if (Engine_Version == 422)
{
toNull.push_back(Memcury::Scanner::FindPattern("48 89 5C 24 ? 57 48 83 EC 30 48 8B 41 28 48 8B DA 48 8B F9 48 85 C0 74 34 48 8B 4B 08 48 8D").Get()); // widget class

View File

@@ -0,0 +1,81 @@
#pragma once
#define CURL_STATICLIB
#include <iostream>
#include <string>
#include <curl/curl.h>
class DiscordWebhook {
public:
// Parameters:
// - webhook_url: the discord HostingWebHook url
DiscordWebhook(const char* webhook_url)
{
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, webhook_url);
// Discord webhooks accept json, so we set the content-type to json data.
curl_slist* headers = curl_slist_append(NULL, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
}
else {
std::cerr << "Error: curl_easy_init() returned NULL pointer" << '\n';
}
}
~DiscordWebhook()
{
curl_global_cleanup();
curl_easy_cleanup(curl);
}
bool handleCode(CURLcode res)
{
return res == CURLE_OK;
}
inline bool send_message(const std::string& message)
{
// The POST json data must be in this format:
// {
// "content": "<MESSAGE HERE>"
// }
std::string json = "{\"content\": \"" + message + "\"}";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json.c_str());
bool success = handleCode(curl_easy_perform(curl));
return success;
}
inline bool send_embedjson(const std::string ajson)
{
std::string json = ajson.contains("embeds") ? ajson : "{\"embeds\": " + ajson + "}";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json.c_str());
bool success = handleCode(curl_easy_perform(curl));
return success;
}
inline bool send_embed(const std::string& title, const std::string& description, int color = 0)
{
std::string json = "{\"embeds\": [{\"title\": \"" + title + "\", \"description\": \"" + description + "\", \"color\": " + "\"" + std::to_string(color) + "\"}]}";
// std::cout << "json: " << json << '\n';
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json.c_str());
bool success = handleCode(curl_easy_perform(curl));
return success;
}
private:
CURL* curl;
};
namespace Information
{
static std::string UptimeWebHook = ("");
}
static DiscordWebhook UptimeWebHook(Information::UptimeWebHook.c_str());

View File

@@ -219,13 +219,13 @@ DWORD WINAPI Main(LPVOID)
bool bUseRemovePlayer = false;
bool bUseSwitchLevel = false;
Hooking::MinHook::Hook(FindObject<ABuildingFoundation>(L"/Script/FortniteGame.Default__BuildingFoundation"),
/* Hooking::MinHook::Hook(FindObject<ABuildingFoundation>(L"/Script/FortniteGame.Default__BuildingFoundation"),
FindObject<UFunction>(L"/Script/FortniteGame.BuildingFoundation.SetDynamicFoundationTransform"),
ABuildingFoundation::SetDynamicFoundationTransformHook, (PVOID*)&ABuildingFoundation::SetDynamicFoundationTransformOriginal, false, true);
Hooking::MinHook::Hook(FindObject<ABuildingFoundation>(L"/Script/FortniteGame.Default__BuildingFoundation"),
FindObject<UFunction>(L"/Script/FortniteGame.BuildingFoundation.SetDynamicFoundationEnabled"),
ABuildingFoundation::SetDynamicFoundationEnabledHook, (PVOID*)&ABuildingFoundation::SetDynamicFoundationEnabledOriginal, false, true);
ABuildingFoundation::SetDynamicFoundationEnabledHook, (PVOID*)&ABuildingFoundation::SetDynamicFoundationEnabledOriginal, false, true); */
if (bUseSwitchLevel)
{