mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 02:42:22 +01:00
a lot
change how abilities work ("more" proper), readded vehicle spawning to s8-s12, fixed respawning on >s4, added a count check to looting so it can't drop 0 count, added zipline jumping, guarantee pawn spawn, clear inventory on aircraft
This commit is contained in:
@@ -35,10 +35,5 @@ public:
|
||||
FGameplayAbilitySpecHandle GiveAbilityEasy(UClass* AbilityClass);
|
||||
FGameplayAbilitySpec* FindAbilitySpecFromHandle(FGameplayAbilitySpecHandle Handle);
|
||||
|
||||
static void ServerTryActivateAbilityHook1(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, PadHex10 PredictionKey);
|
||||
static void ServerTryActivateAbilityHook2(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, PadHex18 PredictionKey);
|
||||
static void ServerTryActivateAbilityWithEventDataHook1(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, PadHex10 PredictionKey, FGameplayEventData TriggerEventData);
|
||||
static void ServerTryActivateAbilityWithEventDataHook2(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, PadHex18 PredictionKey, FGameplayEventData TriggerEventData);
|
||||
|
||||
static void ServerAbilityRPCBatchHook(UAbilitySystemComponent* AbilitySystemComponent, __int64 BatchInfo);
|
||||
static void InternalServerTryActivateAbilityHook(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, const FPredictionKey* PredictionKey, const FGameplayEventData* TriggerEventData);
|
||||
};
|
||||
@@ -25,8 +25,7 @@ void LoopSpecs(UAbilitySystemComponent* AbilitySystemComponent, std::function<vo
|
||||
}
|
||||
}
|
||||
|
||||
void InternalServerTryActivateAbility(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, /* bool InputPressed, */
|
||||
const FPredictionKey* PredictionKey, const FGameplayEventData* TriggerEventData) // https://github.com/EpicGames/UnrealEngine/blob/4.23/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/AbilitySystemComponent_Abilities.cpp#L1445
|
||||
void UAbilitySystemComponent::InternalServerTryActivateAbilityHook(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, const FPredictionKey* PredictionKey, const FGameplayEventData* TriggerEventData) // https://github.com/EpicGames/UnrealEngine/blob/4.23/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/AbilitySystemComponent_Abilities.cpp#L1445
|
||||
{
|
||||
using UGameplayAbility = UObject;
|
||||
|
||||
@@ -157,38 +156,3 @@ FGameplayAbilitySpec* UAbilitySystemComponent::FindAbilitySpecFromHandle(FGamepl
|
||||
|
||||
return SpecToReturn;
|
||||
}
|
||||
|
||||
void UAbilitySystemComponent::ServerTryActivateAbilityHook1(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, PadHex10 PredictionKey)
|
||||
{
|
||||
LOG_INFO(LogAbilities, "ServerTryActivateAbility1");
|
||||
InternalServerTryActivateAbility(AbilitySystemComponent, Handle, /* InputPressed, */ (FPredictionKey*)&PredictionKey, nullptr);
|
||||
}
|
||||
|
||||
void UAbilitySystemComponent::ServerTryActivateAbilityHook2(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, PadHex18 PredictionKey)
|
||||
{
|
||||
LOG_INFO(LogAbilities, "ServerTryActivateAbility2");
|
||||
InternalServerTryActivateAbility(AbilitySystemComponent, Handle, /* InputPressed, */ (FPredictionKey*)&PredictionKey, nullptr);
|
||||
}
|
||||
|
||||
void UAbilitySystemComponent::ServerTryActivateAbilityWithEventDataHook1(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, PadHex10 PredictionKey, FGameplayEventData TriggerEventData)
|
||||
{
|
||||
LOG_INFO(LogAbilities, "ServerTryActivateAbilityWithEventData1");
|
||||
InternalServerTryActivateAbility(AbilitySystemComponent, Handle, /* InputPressed, */
|
||||
(FPredictionKey*)&PredictionKey, &TriggerEventData);
|
||||
}
|
||||
|
||||
void UAbilitySystemComponent::ServerTryActivateAbilityWithEventDataHook2(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, PadHex18 PredictionKey, FGameplayEventData TriggerEventData)
|
||||
{
|
||||
LOG_INFO(LogAbilities, "ServerTryActivateAbilityWithEventData2");
|
||||
InternalServerTryActivateAbility(AbilitySystemComponent, Handle, /* InputPressed, */
|
||||
(FPredictionKey*)&PredictionKey, &TriggerEventData);
|
||||
}
|
||||
|
||||
void UAbilitySystemComponent::ServerAbilityRPCBatchHook(UAbilitySystemComponent* AbilitySystemComponent, __int64 BatchInfo)
|
||||
{
|
||||
static auto AbilitySpecHandleOffset = 0x0;
|
||||
static auto PredictionKeyOffset = 0x0008;
|
||||
|
||||
InternalServerTryActivateAbility(AbilitySystemComponent, *(FGameplayAbilitySpecHandle*)(__int64(BatchInfo) + AbilitySpecHandleOffset),
|
||||
/* InputPressed, */ (FPredictionKey*)(__int64(BatchInfo) + PredictionKeyOffset), nullptr);
|
||||
}
|
||||
2
Project Reboot 3.0/BuildingGameplayActorSpawnMachine.h
Normal file
2
Project Reboot 3.0/BuildingGameplayActorSpawnMachine.h
Normal file
@@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
|
||||
@@ -10,5 +10,5 @@ class AFortAthenaSupplyDrop : public ABuildingGameplayActor
|
||||
public:
|
||||
static inline AFortPickup* (*SpawnPickupOriginal)(UObject* Context, FFrame& Stack, AFortPickup** Ret);
|
||||
|
||||
static AFortPickup* SpawnPickupHook(UObject* Context, FFrame& Stack, AFortPickup** Ret); // Unfortuanetly this function will never get called since we dont hook picklootdrops
|
||||
static AFortPickup* SpawnPickupHook(UObject* Context, FFrame& Stack, AFortPickup** Ret);
|
||||
};
|
||||
@@ -760,25 +760,16 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
|
||||
|
||||
LOG_INFO(LogDev, "Spawned loot!");
|
||||
|
||||
static bool bSpawnedVehicles = Engine_Version < 424; // todo fix
|
||||
|
||||
if (!bSpawnedVehicles)
|
||||
if (Engine_Version >= 423 && Engine_Version < 426) // 423+ we need to spawn manually and vehicle sync doesn't work on >S13.
|
||||
{
|
||||
bSpawnedVehicles = true;
|
||||
static int LastNum420 = 1;
|
||||
|
||||
/* static auto GalileoSpawnerClass = FindObject<UClass>("/Game/Athena/AI/Galileo/BP_Galileo_Spawner.BP_Galileo_Spawner_C");
|
||||
auto GalileoSpawners = UGameplayStatics::GetAllActorsOfClass(GetWorld(), GalileoSpawnerClass);
|
||||
|
||||
LOG_INFO(LogDev, "GalileoSpawners.Num(): {}", GalileoSpawners.Num());
|
||||
|
||||
for (int i = 0; i < GalileoSpawners.Num(); i++)
|
||||
if (AmountOfRestarts != LastNum420)
|
||||
{
|
||||
auto GalileoSpawner = GalileoSpawners.at(i);
|
||||
LastNum420 = AmountOfRestarts;
|
||||
|
||||
auto NewPawn = SpawnAIFromCustomizationData(GalileoSpawner->GetActorLocation(), GalileoSpawner->Get("BotData"));
|
||||
} */
|
||||
|
||||
// SpawnVehicles();
|
||||
SpawnVehicles2();
|
||||
}
|
||||
}
|
||||
|
||||
auto NewPlayer = (AFortPlayerControllerAthena*)NewPlayerActor;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "reboot.h"
|
||||
#include "FortPlayerStateAthena.h"
|
||||
#include "FortGameModeAthena.h"
|
||||
|
||||
/* void AFortGameStateAthena::AddPlayerStateToGameMemberInfo(class AFortPlayerStateAthena* PlayerState)
|
||||
{
|
||||
@@ -54,11 +55,62 @@ int AFortGameStateAthena::GetAircraftIndex(AFortPlayerState* PlayerState)
|
||||
|
||||
bool AFortGameStateAthena::IsRespawningAllowed(AFortPlayerState* PlayerState) // actually in zone
|
||||
{
|
||||
auto GameModeAthena = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
|
||||
static auto IsRespawningAllowedFn = FindObject<UFunction>("/Script/FortniteGame.FortGameStateZone.IsRespawningAllowed");
|
||||
|
||||
LOG_INFO(LogDev, "IsRespawningAllowedFn: {}", __int64(IsRespawningAllowedFn));
|
||||
|
||||
if (!IsRespawningAllowedFn)
|
||||
{
|
||||
auto CurrentPlaylist = GetCurrentPlaylist();
|
||||
|
||||
if (!CurrentPlaylist)
|
||||
return false;
|
||||
|
||||
static auto RespawnTypeOffset = CurrentPlaylist->GetOffset("RespawnType");
|
||||
|
||||
if (RespawnTypeOffset == -1)
|
||||
return false;
|
||||
|
||||
auto& RespawnType = CurrentPlaylist->Get<uint8_t>(RespawnTypeOffset);
|
||||
LOG_INFO(LogDev, "RespawnType: {}", (int)RespawnType);
|
||||
|
||||
if (RespawnType == 1)
|
||||
return true;
|
||||
|
||||
if (RespawnType == 2) // InfiniteRespawnExceptStorm
|
||||
{
|
||||
static auto SafeZoneIndicatorOffset = GameModeAthena->GetOffset("SafeZoneIndicator");
|
||||
auto SafeZoneIndicator = GameModeAthena->Get<AActor*>(SafeZoneIndicatorOffset);
|
||||
|
||||
if (!SafeZoneIndicator)
|
||||
return true;
|
||||
|
||||
/*
|
||||
|
||||
10.40
|
||||
|
||||
bool __fastcall sub_7FF68F5A83A0(__int64 SafeZoneIndicator, float *a2)
|
||||
{
|
||||
__m128 v2; // xmm1
|
||||
float v3; // xmm2_4
|
||||
|
||||
v2 = *(*(SafeZoneIndicator + 928) + 464i64);
|
||||
v3 = _mm_shuffle_ps(v2, v2, 85).m128_f32[0];
|
||||
return (*(SafeZoneIndicator + 924) * *(SafeZoneIndicator + 924)) >= (((v3 - a2[1]) * (v3 - a2[1]))
|
||||
+ ((v2.m128_f32[0] - *a2) * (v2.m128_f32[0] - *a2)));
|
||||
}
|
||||
|
||||
If this returns true, then return true
|
||||
|
||||
*/
|
||||
|
||||
return true; // Do this until we implement ^^
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
struct { AFortPlayerState* PlayerState; bool ReturnValue; } AFortGameStateZone_IsRespawningAllowed_Params{PlayerState};
|
||||
this->ProcessEvent(IsRespawningAllowedFn, &AFortGameStateZone_IsRespawningAllowed_Params);
|
||||
|
||||
|
||||
@@ -312,7 +312,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
|
||||
if (!LootPackage)
|
||||
continue;
|
||||
|
||||
if (LootPackage->GetLootPackageID() == ChosenRowLootTierData->GetLootPackage() && LootPackage->GetWeight() != 0)
|
||||
if (LootPackage->GetLootPackageID() == ChosenRowLootTierData->GetLootPackage() && LootPackage->GetWeight() != 0 && LootPackage->GetCount() != 0)
|
||||
{
|
||||
TierGroupLPs.push_back(LootPackage);
|
||||
}
|
||||
@@ -409,7 +409,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
|
||||
|
||||
auto LootPackage = (FFortLootPackageData*)CurrentLP.Value();
|
||||
|
||||
if (LootPackage->GetLootPackageID().ToString() == TierGroupLPStr && LootPackage->GetWeight() != 0)
|
||||
if (LootPackage->GetLootPackageID().ToString() == TierGroupLPStr && LootPackage->GetWeight() != 0 && LootPackage->GetCount() != 0)
|
||||
{
|
||||
lootPackageCalls.push_back(LootPackage);
|
||||
}
|
||||
|
||||
@@ -169,13 +169,13 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame*
|
||||
FVector LocationToSpawnLoot = ReceivingActor->GetActorLocation() + ReceivingActor->GetActorRightVector() * 70.f + FVector{ 0, 0, 50 };
|
||||
|
||||
static auto FortAthenaVehicleClass = FindObject<UClass>("/Script/FortniteGame.FortAthenaVehicle");
|
||||
static auto SearchAnimationCountOffset = FindOffsetStruct("/Script/FortniteGame.FortSearchBounceData", "SearchAnimationCount");
|
||||
|
||||
if (auto BuildingContainer = Cast<ABuildingContainer>(ReceivingActor))
|
||||
{
|
||||
static auto bAlreadySearchedOffset = BuildingContainer->GetOffset("bAlreadySearched");
|
||||
static auto SearchBounceDataOffset = BuildingContainer->GetOffset("SearchBounceData");
|
||||
static auto bAlreadySearchedFieldMask = GetFieldMask(BuildingContainer->GetProperty("bAlreadySearched"));
|
||||
static auto SearchAnimationCountOffset = FindOffsetStruct("/Script/FortniteGame.FortSearchBounceData", "SearchAnimationCount");
|
||||
|
||||
auto SearchBounceData = BuildingContainer->GetPtr<void>(SearchBounceDataOffset);
|
||||
|
||||
|
||||
@@ -14,6 +14,40 @@ void AFortPlayerPawn::ServerChoosePart(EFortCustomPartType Part, UObject* Chosen
|
||||
this->ProcessEvent(fn, &AFortPlayerPawn_ServerChoosePart_Params);
|
||||
}
|
||||
|
||||
void AFortPlayerPawn::ForceLaunchPlayerZiplinine() // Thanks android
|
||||
{
|
||||
float ZiplineJumpDampening = -0.5f;
|
||||
float ZiplineJumpStrength = 1500.f;
|
||||
|
||||
static auto CharacterMovementOffset = GetOffset("CharacterMovement");
|
||||
auto CharacterMovement = this->Get(CharacterMovementOffset);
|
||||
|
||||
static auto VelocityOffset = CharacterMovement->GetOffset("Velocity");
|
||||
auto& v23 = CharacterMovement->Get<FVector>(VelocityOffset);
|
||||
//v23.X = abs(v23.X);
|
||||
//v23.Y = abs(v23.Y);
|
||||
|
||||
FVector v21 = { -750, -750, ZiplineJumpStrength };
|
||||
|
||||
if (ZiplineJumpDampening * v23.X >= -750.f)
|
||||
v21.X = fminf(ZiplineJumpDampening * v23.X, 750);
|
||||
|
||||
if (ZiplineJumpDampening * v23.Y >= -750.f)
|
||||
v21.Y = fminf(ZiplineJumpDampening * v23.Y, 750);
|
||||
|
||||
// todo check if in vehicle
|
||||
|
||||
static auto LaunchCharacterFn = FindObject<UFunction>("/Script/Engine.Character.LaunchCharacter");
|
||||
|
||||
struct
|
||||
{
|
||||
FVector LaunchVelocity; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||
bool bXYOverride; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||
bool bZOverride; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||
} ACharacter_LaunchCharacter_Params{ v21, false, false };
|
||||
ProcessEvent(LaunchCharacterFn, &ACharacter_LaunchCharacter_Params);
|
||||
}
|
||||
|
||||
void AFortPlayerPawn::ServerSendZiplineStateHook(AFortPlayerPawn* Pawn, FZiplinePawnState InZiplineState)
|
||||
{
|
||||
static auto ZiplineStateOffset = Pawn->GetOffset("ZiplineState");
|
||||
@@ -28,9 +62,18 @@ void AFortPlayerPawn::ServerSendZiplineStateHook(AFortPlayerPawn* Pawn, FZipline
|
||||
static auto ZiplinePawnStateSize = ZiplinePawnStateStruct->GetPropertiesSize();
|
||||
|
||||
CopyStruct(PawnZiplineState, &InZiplineState, ZiplinePawnStateSize);
|
||||
}
|
||||
|
||||
static bool bFoundFunc = false;
|
||||
static auto bIsZipliningOffset = FindOffsetStruct("/Script/FortniteGame.ZiplinePawnState", "bIsZiplining");
|
||||
static auto bJumpedOffset = FindOffsetStruct("/Script/FortniteGame.ZiplinePawnState", "bJumped");
|
||||
|
||||
if (!(*(bool*)(__int64(PawnZiplineState) + bIsZipliningOffset)))
|
||||
{
|
||||
if ((*(bool*)(__int64(PawnZiplineState) + bJumpedOffset)))
|
||||
{
|
||||
Pawn->ForceLaunchPlayerZiplinine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void (*OnRep_ZiplineState)(AFortPlayerPawn* Pawn) = decltype(OnRep_ZiplineState)(Addresses::OnRep_ZiplineState);
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ class AFortPlayerPawn : public AFortPawn
|
||||
{
|
||||
public:
|
||||
void ServerChoosePart(EFortCustomPartType Part, class UObject* ChosenCharacterPart);
|
||||
void ForceLaunchPlayerZiplinine(); // Thanks android
|
||||
|
||||
static void ServerSendZiplineStateHook(AFortPlayerPawn* Pawn, FZiplinePawnState InZiplineState);
|
||||
static void ServerHandlePickupHook(AFortPlayerPawn* Pawn, AFortPickup* Pickup, float InFlyTime, FVector InStartDirection, bool bPlayPickupSound);
|
||||
|
||||
58
Project Reboot 3.0/FortPlayerStateAthena.cpp
Normal file
58
Project Reboot 3.0/FortPlayerStateAthena.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#include "FortPlayerStateAthena.h"
|
||||
#include "Stack.h"
|
||||
#include "FortPlayerControllerAthena.h"
|
||||
|
||||
void AFortPlayerStateAthena::ServerSetInAircraftHook(UObject* Context, FFrame& Stack, void* Ret)
|
||||
{
|
||||
auto PlayerState = (AFortPlayerStateAthena*)Context;
|
||||
auto PlayerController = Cast<AFortPlayerControllerAthena>(PlayerState->GetOwner());
|
||||
|
||||
if (!PlayerController)
|
||||
return;
|
||||
|
||||
// std::cout << "bNewInAircraft: " << bNewInAircraft << '\n';
|
||||
// std::cout << "PlayerController->IsInAircraft(): " << PlayerController->IsInAircraft() << '\n';
|
||||
|
||||
struct aaa { bool wtf; };
|
||||
|
||||
auto bNewInAircraft = ((aaa*)Stack.Locals)->wtf;// *(bool*)Stack.Locals;
|
||||
auto WorldInventory = PlayerController->GetWorldInventory();
|
||||
auto& InventoryList = WorldInventory->GetItemList();
|
||||
|
||||
auto& ItemInstances = InventoryList.GetItemInstances();
|
||||
|
||||
if ((/* (bNewInAircraft && !PlayerController->IsInAircraft()) || */ (Globals::bLateGame ? bNewInAircraft : true)) && ItemInstances.Num())
|
||||
{
|
||||
// std::cout << "InventoryList.ItemInstances.Num(): " << InventoryList.ItemInstances.Num() << '\n';
|
||||
|
||||
std::vector<std::pair<FGuid, int>> GuidAndCountsToRemove;
|
||||
|
||||
for (int i = 0; i < ItemInstances.Num(); i++)
|
||||
{
|
||||
auto ItemEntry = ItemInstances.at(i)->GetItemEntry();
|
||||
auto ItemDefinition = Cast<UFortWorldItemDefinition>(ItemEntry->GetItemDefinition());
|
||||
|
||||
if (!ItemDefinition)
|
||||
continue;
|
||||
|
||||
if (!ItemDefinition->CanBeDropped())
|
||||
continue;
|
||||
|
||||
GuidAndCountsToRemove.push_back({ ItemEntry->GetItemGuid(), ItemEntry->GetCount() });
|
||||
}
|
||||
|
||||
for (auto& Pair : GuidAndCountsToRemove)
|
||||
{
|
||||
WorldInventory->RemoveItem(Pair.first, nullptr, Pair.second);
|
||||
}
|
||||
|
||||
WorldInventory->Update();
|
||||
|
||||
static auto CurrentShieldOffset = PlayerState->GetOffset("CurrentShield");
|
||||
|
||||
if (CurrentShieldOffset != -1)
|
||||
PlayerState->Get<float>(CurrentShieldOffset) = 0; // real
|
||||
}
|
||||
|
||||
return ServerSetInAircraftOriginal(Context, Stack, Ret);
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "FortPlayerState.h"
|
||||
#include "Stack.h"
|
||||
|
||||
class AFortPlayerStateAthena : public AFortPlayerState
|
||||
{
|
||||
public:
|
||||
static inline void (*ServerSetInAircraftOriginal)(UObject* Context, FFrame& Stack, void* Ret);
|
||||
|
||||
uint8& GetSquadId()
|
||||
{
|
||||
static auto SquadIdOffset = GetOffset("SquadId");
|
||||
@@ -31,6 +34,8 @@ public:
|
||||
this->ProcessEvent(ClientReportKillFn, &Player);
|
||||
}
|
||||
|
||||
static void ServerSetInAircraftHook(UObject* Context, FFrame& Stack, void* Ret);
|
||||
|
||||
static UClass* StaticClass()
|
||||
{
|
||||
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortPlayerStateAthena");
|
||||
|
||||
@@ -29,10 +29,20 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
|
||||
|
||||
static auto fn = FindObject<UFunction>(L"/Script/Engine.GameModeBase.SpawnDefaultPawnAtTransform");
|
||||
|
||||
struct { AController* NewPlayer; FTransform SpawnTransform; APawn* ReturnValue; }
|
||||
AGameModeBase_SpawnDefaultPawnAtTransform_Params{NewPlayer, StartSpot->GetTransform()};
|
||||
FTransform SpawnTransform = StartSpot->GetTransform();
|
||||
|
||||
GameMode->ProcessEvent(fn, &AGameModeBase_SpawnDefaultPawnAtTransform_Params);
|
||||
struct { AController* NewPlayer; FTransform SpawnTransform; APawn* ReturnValue; }
|
||||
AGameModeBase_SpawnDefaultPawnAtTransform_Params{NewPlayer, SpawnTransform };
|
||||
|
||||
// GameMode->ProcessEvent(fn, &AGameModeBase_SpawnDefaultPawnAtTransform_Params);
|
||||
|
||||
FActorSpawnParameters SpawnParameters{};
|
||||
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;
|
||||
|
||||
auto NewPawn = GetWorld()->SpawnActor<APawn>(PawnClass, SpawnTransform, SpawnParameters); // AGameModeBase_SpawnDefaultPawnAtTransform_Params.ReturnValue;
|
||||
|
||||
if (!NewPawn)
|
||||
return nullptr;
|
||||
|
||||
bool bIsRespawning = false;
|
||||
|
||||
@@ -68,8 +78,8 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
|
||||
WorldInventory->AddItem(BuildingItemData_Stair_W, nullptr);
|
||||
WorldInventory->AddItem(BuildingItemData_RoofS, nullptr);
|
||||
WorldInventory->AddItem(PickaxeDefinition, nullptr);
|
||||
WorldInventory->AddItem(WoodItemData, nullptr, 100);
|
||||
WorldInventory->AddItem(DamageTrap, nullptr);
|
||||
// WorldInventory->AddItem(WoodItemData, nullptr, 100);
|
||||
// WorldInventory->AddItem(DamageTrap, nullptr);
|
||||
// WorldInventory->AddItem(FindObject<UFortItemDefinition>(L"/ParallelGameplay/Items/WestSausage/WID_WestSausage_Parallel.WID_WestSausage_Parallel"), nullptr, 1, 1000);
|
||||
// WorldInventory->AddItem(FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Consumables/HappyGhost/WID_Athena_HappyGhost.WID_Athena_HappyGhost"), nullptr);
|
||||
|
||||
@@ -78,5 +88,5 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
|
||||
}
|
||||
}
|
||||
|
||||
return AGameModeBase_SpawnDefaultPawnAtTransform_Params.ReturnValue;
|
||||
return NewPawn;
|
||||
}
|
||||
@@ -198,6 +198,7 @@
|
||||
<ClCompile Include="FortPlayerController.cpp" />
|
||||
<ClCompile Include="FortPlayerControllerAthena.cpp" />
|
||||
<ClCompile Include="FortPlayerPawn.cpp" />
|
||||
<ClCompile Include="FortPlayerStateAthena.cpp" />
|
||||
<ClCompile Include="FortPlaysetItemDefinition.cpp" />
|
||||
<ClCompile Include="FortWeapon.cpp" />
|
||||
<ClCompile Include="FortWeaponItemDefinition.cpp" />
|
||||
@@ -233,6 +234,7 @@
|
||||
<ClInclude Include="BuildingActor.h" />
|
||||
<ClInclude Include="BuildingContainer.h" />
|
||||
<ClInclude Include="BuildingGameplayActor.h" />
|
||||
<ClInclude Include="BuildingGameplayActorSpawnMachine.h" />
|
||||
<ClInclude Include="BuildingSMActor.h" />
|
||||
<ClInclude Include="BuildingTrap.h" />
|
||||
<ClInclude Include="calendar.h" />
|
||||
|
||||
@@ -164,6 +164,9 @@
|
||||
<ClCompile Include="GameMode.cpp">
|
||||
<Filter>Engine\Source\Runtime\Engine\Private</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FortPlayerStateAthena.cpp">
|
||||
<Filter>FortniteGame\Source\FortniteGame\Private\Player</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="log.h" />
|
||||
@@ -470,6 +473,9 @@
|
||||
<ClInclude Include="StringAssetReference.h">
|
||||
<Filter>Engine\Source\Runtime\CoreUObject\Public\Misc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BuildingGameplayActorSpawnMachine.h">
|
||||
<Filter>FortniteGame\Source\FortniteGame\Public\Building\GameplayActors</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Engine">
|
||||
|
||||
@@ -19,7 +19,7 @@ struct TSoftObjectPtr
|
||||
public:
|
||||
FSoftObjectPtr SoftObjectPtr;
|
||||
|
||||
T* Get()
|
||||
T* Get(UClass* ClassToLoad = nullptr, bool bTryToLoad = false)
|
||||
{
|
||||
if (Engine_Version <= 416)
|
||||
{
|
||||
@@ -31,6 +31,11 @@ public:
|
||||
if (SoftObjectPtr.ObjectID.AssetPathName.ComparisonIndex.Value <= 0)
|
||||
return nullptr;
|
||||
|
||||
if (bTryToLoad)
|
||||
{
|
||||
return LoadObject<T>(SoftObjectPtr.ObjectID.AssetPathName.ToString(), ClassToLoad);
|
||||
}
|
||||
|
||||
return FindObject<T>(SoftObjectPtr.ObjectID.AssetPathName.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,5 +79,5 @@ void UWorld::Listen()
|
||||
*(UNetDriver**)(__int64(LevelCollections.AtPtr(0, LevelCollectionSize)) + 0x10) = NewNetDriver;
|
||||
*(UNetDriver**)(__int64(LevelCollections.AtPtr(1, LevelCollectionSize)) + 0x10) = NewNetDriver;
|
||||
|
||||
LOG_INFO(LogNet, "Listening on port {}!", Port);
|
||||
LOG_INFO(LogNet, "Listening on port {}!", Port + AmountOfRestarts);
|
||||
}
|
||||
@@ -96,6 +96,7 @@ DWORD WINAPI Main(LPVOID)
|
||||
static auto FortPlayerControllerAthenaDefault = FindObject<AFortPlayerControllerAthena>(L"/Script/FortniteGame.Default__FortPlayerControllerAthena"); // FindObject<UClass>(L"/Game/Athena/Athena_PlayerController.Default__Athena_PlayerController_C");
|
||||
static auto FortPlayerPawnAthenaDefault = FindObject<AFortPlayerPawn>(L"/Game/Athena/PlayerPawn_Athena.Default__PlayerPawn_Athena_C");
|
||||
static auto FortAbilitySystemComponentAthenaDefault = FindObject<UObject>(L"/Script/FortniteGame.Default__FortAbilitySystemComponentAthena");
|
||||
static auto FortPlayerStateAthenaDefault = FindObject<AFortPlayerStateAthena>(L"/Script/FortniteGame.Default__FortPlayerStateAthena");
|
||||
static auto FortKismetLibraryDefault = FindObject<UFortKismetLibrary>(L"/Script/FortniteGame.Default__FortKismetLibrary");
|
||||
static auto AthenaMarkerComponentDefault = FindObject<UAthenaMarkerComponent>(L"/Script/FortniteGame.Default__AthenaMarkerComponent");
|
||||
|
||||
@@ -287,6 +288,9 @@ DWORD WINAPI Main(LPVOID)
|
||||
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerTeleportToPlaygroundLobbyIsland"),
|
||||
AFortPlayerControllerAthena::ServerTeleportToPlaygroundLobbyIslandHook, nullptr, false);
|
||||
|
||||
Hooking::MinHook::Hook(FortPlayerStateAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerStateAthena.ServerSetInAircraft"),
|
||||
AFortPlayerStateAthena::ServerSetInAircraftHook, (PVOID*)&AFortPlayerStateAthena::ServerSetInAircraftOriginal, false, true); // We could use second method but eh
|
||||
|
||||
Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawn.ServerSendZiplineState"),
|
||||
AFortPlayerPawn::ServerSendZiplineStateHook, nullptr, false);
|
||||
|
||||
@@ -376,23 +380,32 @@ DWORD WINAPI Main(LPVOID)
|
||||
|
||||
if (Globals::bAbilitiesEnabled)
|
||||
{
|
||||
if (PredictionKeySize == 0x10)
|
||||
int InternalServerTryActivateAbilityIndex = 0;
|
||||
|
||||
if (Engine_Version > 420)
|
||||
{
|
||||
Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject<UFunction>(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbility"),
|
||||
UAbilitySystemComponent::ServerTryActivateAbilityHook1, nullptr, false);
|
||||
Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject<UFunction>(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbilityWithEventData"),
|
||||
UAbilitySystemComponent::ServerTryActivateAbilityWithEventDataHook1, nullptr, false);
|
||||
static auto OnRep_ReplicatedAnimMontageFn = FindObject<UFunction>("/Script/GameplayAbilities.AbilitySystemComponent.OnRep_ReplicatedAnimMontage");
|
||||
InternalServerTryActivateAbilityIndex = (GetFunctionIdxOrPtr(OnRep_ReplicatedAnimMontageFn) - 8) / 8;
|
||||
}
|
||||
else if (PredictionKeySize == 0x18)
|
||||
else
|
||||
{
|
||||
Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject<UFunction>(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbility"),
|
||||
UAbilitySystemComponent::ServerTryActivateAbilityHook2, nullptr, false);
|
||||
Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject<UFunction>(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbilityWithEventData"),
|
||||
UAbilitySystemComponent::ServerTryActivateAbilityWithEventDataHook2, nullptr, false);
|
||||
static auto ServerTryActivateAbilityWithEventDataFn = FindObject<UFunction>(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbilityWithEventData");
|
||||
auto ServerTryActivateAbilityWithEventDataNativeAddr = __int64(FortAbilitySystemComponentAthenaDefault->VFTable[GetFunctionIdxOrPtr(ServerTryActivateAbilityWithEventDataFn) / 8]);
|
||||
|
||||
for (int i = 0; i < 400; i++)
|
||||
{
|
||||
if ((*(uint8_t*)(ServerTryActivateAbilityWithEventDataNativeAddr + i) == 0xFF && *(uint8_t*)(ServerTryActivateAbilityWithEventDataNativeAddr + i + 1) == 0x90) || // call qword ptr
|
||||
(*(uint8_t*)(ServerTryActivateAbilityWithEventDataNativeAddr + i) == 0xFF && *(uint8_t*)(ServerTryActivateAbilityWithEventDataNativeAddr + i + 1) == 0x93)) // call qword ptr
|
||||
{
|
||||
InternalServerTryActivateAbilityIndex = GetIndexFromVirtualFunctionCall(ServerTryActivateAbilityWithEventDataNativeAddr + i) / 8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject<UFunction>(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerAbilityRPCBatch"),
|
||||
// UAbilitySystemComponent::ServerAbilityRPCBatchHook, nullptr, false);
|
||||
LOG_INFO(LogDev, "InternalServerTryActivateAbilityIndex: 0x{:x}", InternalServerTryActivateAbilityIndex);
|
||||
|
||||
VirtualSwap(FortAbilitySystemComponentAthenaDefault->VFTable, InternalServerTryActivateAbilityIndex, UAbilitySystemComponent::InternalServerTryActivateAbilityHook);
|
||||
}
|
||||
|
||||
if (Engine_Version >= 424)
|
||||
|
||||
@@ -1169,7 +1169,7 @@ static inline uint64 FindReplaceBuildingActor()
|
||||
}
|
||||
|
||||
return FindBytes(StringRef,
|
||||
(Engine_Version == 420 || Engine_Version == 421 || Fortnite_Version >= 18 ? std::vector<uint8_t>{ 0x48, 0x8B, 0xC4 } : std::vector<uint8_t>{ 0x4C, 0x8B }),
|
||||
(Engine_Version == 420 || Engine_Version == 421 || Engine_Version >= 427 ? std::vector<uint8_t>{ 0x48, 0x8B, 0xC4 } : std::vector<uint8_t>{ 0x4C, 0x8B }),
|
||||
1000, 0, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Globals
|
||||
{
|
||||
extern inline bool bCreative = false;
|
||||
extern inline bool bGoingToPlayEvent = false;
|
||||
extern inline bool bNoMCP = true;
|
||||
extern inline bool bNoMCP = false;
|
||||
extern inline bool bLateGame = false;
|
||||
extern inline bool bAbilitiesEnabled = true;
|
||||
extern inline bool bLogProcessEvent = false;
|
||||
|
||||
@@ -77,6 +77,37 @@ inline __int64 GetFunctionIdxOrPtr2(UFunction* Function)
|
||||
return functionAddyOrOffset;
|
||||
}
|
||||
|
||||
inline __int64 GetIndexFromVirtualFunctionCall(__int64 NativeAddr)
|
||||
{
|
||||
std::string wtf = "";
|
||||
|
||||
int shots = 0;
|
||||
|
||||
bool bFoundFirstNumber = false;
|
||||
|
||||
for (__int64 z = (NativeAddr + 5); z != (NativeAddr + 1); z -= 1)
|
||||
{
|
||||
auto anafa = (int)(*(uint8_t*)z);
|
||||
|
||||
auto asfk = anafa < 10 ? "0" + std::format("{:x}", anafa) : std::format("{:x}", anafa);
|
||||
|
||||
// std::cout << std::format("[{}] 0x{}\n", shots, asfk);
|
||||
|
||||
if (*(uint8_t*)z == 0 ? bFoundFirstNumber : true)
|
||||
{
|
||||
wtf += asfk;
|
||||
bFoundFirstNumber = true;
|
||||
}
|
||||
|
||||
shots++;
|
||||
}
|
||||
|
||||
std::transform(wtf.begin(), wtf.end(), wtf.begin(), ::toupper);
|
||||
|
||||
// LOG_INFO(LogDev, "wtf: {}", wtf);
|
||||
|
||||
return HexToDec(wtf);
|
||||
}
|
||||
|
||||
inline __int64 GetFunctionIdxOrPtr(UFunction* Function)
|
||||
{
|
||||
@@ -114,34 +145,7 @@ inline __int64 GetFunctionIdxOrPtr(UFunction* Function)
|
||||
{
|
||||
if (bFoundValidate)
|
||||
{
|
||||
std::string wtf = "";
|
||||
|
||||
int shots = 0;
|
||||
|
||||
bool bFoundFirstNumber = false;
|
||||
|
||||
for (__int64 z = (NativeAddr + i + 5); z != (NativeAddr + i + 1); z -= 1)
|
||||
{
|
||||
auto anafa = (int)(*(uint8_t*)z);
|
||||
|
||||
auto asfk = anafa < 10 ? "0" + std::format("{:x}", anafa) : std::format("{:x}", anafa);
|
||||
|
||||
// std::cout << std::format("[{}] 0x{}\n", shots, asfk);
|
||||
|
||||
if (*(uint8_t*)z == 0 ? bFoundFirstNumber : true)
|
||||
{
|
||||
wtf += asfk;
|
||||
bFoundFirstNumber = true;
|
||||
}
|
||||
|
||||
shots++;
|
||||
}
|
||||
|
||||
std::transform(wtf.begin(), wtf.end(), wtf.begin(), ::toupper);
|
||||
|
||||
// LOG_INFO(LogDev, "wtf: {}", wtf);
|
||||
|
||||
return HexToDec(wtf);
|
||||
return GetIndexFromVirtualFunctionCall(NativeAddr + i);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -128,11 +128,12 @@ static inline AActor* SpawnVehicleFromSpawner(AActor* VehicleSpawner)
|
||||
SpawnTransform.Scale3D = { 1, 1, 1 };
|
||||
|
||||
static auto VehicleClassOffset = VehicleSpawner->GetOffset("VehicleClass", false);
|
||||
static auto BGAClass = FindObject<UClass>("/Script/Engine.BlueprintGeneratedClass");
|
||||
|
||||
if (VehicleClassOffset != -1) // 10.40 and below?
|
||||
{
|
||||
auto& SoftVehicleClass = VehicleSpawner->Get<TSoftObjectPtr<UClass>>(VehicleClassOffset);
|
||||
auto StrongVehicleClass = SoftVehicleClass.Get();
|
||||
auto StrongVehicleClass = SoftVehicleClass.Get(BGAClass, true);
|
||||
|
||||
if (!StrongVehicleClass)
|
||||
{
|
||||
@@ -150,7 +151,7 @@ static inline AActor* SpawnVehicleFromSpawner(AActor* VehicleSpawner)
|
||||
return nullptr;
|
||||
|
||||
auto& SoftFortVehicleItemDef = VehicleSpawner->Get<TSoftObjectPtr<UFortItemDefinition>>(FortVehicleItemDefOffset);
|
||||
auto StrongFortVehicleItemDef = SoftFortVehicleItemDef.Get();
|
||||
auto StrongFortVehicleItemDef = SoftFortVehicleItemDef.Get(nullptr, true);
|
||||
|
||||
if (!StrongFortVehicleItemDef)
|
||||
{
|
||||
@@ -161,7 +162,7 @@ static inline AActor* SpawnVehicleFromSpawner(AActor* VehicleSpawner)
|
||||
|
||||
static auto VehicleActorClassOffset = StrongFortVehicleItemDef->GetOffset("VehicleActorClass");
|
||||
auto& SoftVehicleActorClass = StrongFortVehicleItemDef->Get<TSoftObjectPtr<UClass>>(VehicleActorClassOffset);
|
||||
auto StrongVehicleActorClass = SoftVehicleActorClass.Get();
|
||||
auto StrongVehicleActorClass = SoftVehicleActorClass.Get(BGAClass, true);
|
||||
|
||||
if (!StrongVehicleActorClass)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user