Revert "i gotta go to school bro"

This reverts commit f41be934eb.
This commit is contained in:
Milxnor
2023-05-12 17:51:39 -04:00
parent 9be64d79ca
commit 07d42b42f2
5 changed files with 27 additions and 120 deletions

View File

@@ -25,54 +25,8 @@ void UFortGadgetItemDefinition::UpdateTrackedAttributesHook(UFortGadgetItemDefin
{
// LOG_INFO(LogDev, "UpdateTrackedAttributesHook Return: 0x{:x}", __int64(_ReturnAddress()) - __int64(GetModuleHandleW(0)));
return;
AFortPlayerState* PlayerState = nullptr; // how do we get it bro....
UAbilitySystemComponent* ASC = PlayerState->GetAbilitySystemComponent();
if (GadgetItemDefinition->ShouldDestroyGadgetWhenTrackedAttributesIsZero())
{
bool bIsEveryTrackedAttributeZero = true;
for (int i = 0; i < GadgetItemDefinition->GetTrackedAttributes().Num(); i++)
{
auto& CurrentTrackedAttribute = GadgetItemDefinition->GetTrackedAttributes().at(i);
// LOG_INFO(LogDev, "[{}] TrackedAttribute Attribute Property Name {}", i, GadgetItemDefinition->GetTrackedAttributes().at(i).GetAttributePropertyName());
// LOG_INFO(LogDev, "[{}] TrackedAttribute Attribute Name {}", i, GadgetItemDefinition->GetTrackedAttributes().at(i).GetAttributeName());
// LOG_INFO(LogDev, "[{}] TrackedAttribute Attribute Owner {}", i, GadgetItemDefinition->GetTrackedAttributes().at(i).AttributeOwner->GetPathName());
if (!ASC)
break;
int CurrentAttributeValue = -1;
for (int i = 0; i < ASC->GetSpawnedAttributes().Num(); i++)
{
auto CurrentSpawnedAttribute = ASC->GetSpawnedAttributes().at(i);
if (CurrentSpawnedAttribute->IsA(CurrentTrackedAttribute.AttributeOwner))
{
auto PropertyOffset = CurrentSpawnedAttribute->GetOffset(CurrentTrackedAttribute.GetAttributePropertyName());
if (PropertyOffset != -1)
{
if (CurrentSpawnedAttribute->GetPtr<FFortGameplayAttributeData>(PropertyOffset)->GetCurrentValue() != 0)
{
bIsEveryTrackedAttributeZero = false;
break;
}
}
}
}
}
if (bIsEveryTrackedAttributeZero)
{
// REMOVE THE ITEM
static auto MulticastTriggerOnGadgetTrackedAttributeDestroyedFXFn = FindObject<UFunction>("/Script/FortniteGame.FortPlayerStateZone.MulticastTriggerOnGadgetTrackedAttributeDestroyedFX");
PlayerState->ProcessEvent(MulticastTriggerOnGadgetTrackedAttributeDestroyedFXFn, &GadgetItemDefinition);
}
// PlayerState->MulticastTriggerOnGadgetTrackedAttributeDestroyedFX
}
}

View File

@@ -17,19 +17,14 @@ struct FFortGameFeatureLootTableData
#ifdef EXPERIMENTAL_LOOTING
template <typename RowStructType = uint8>
void CollectDataTablesRows(const std::vector<UDataTable*>& DataTables, std::map<FName, RowStructType*>* OutMap, std::function<bool(FName, RowStructType*)> Check = []() { return true; })
void CollectDataTablesRows(std::vector<UDataTable*> DataTables, std::map<FName, RowStructType*>* OutMap, std::function<bool(FName, RowStructType*)> Check = []() { return true; })
{
std::vector<UDataTable*> DataTablesToIterate;
static auto CompositeDataTableClass = FindObject<UClass>(L"/Script/Engine.CompositeDataTable");
static auto CompositeDataTableClass = FindObject<UClass>("/Script/Engine.CompositeDataTable");
for (UDataTable* DataTable : DataTables)
for (auto DataTable : DataTables)
{
if (!DataTable->IsValidLowLevel())
{
continue; // Remove from vector?
}
// if (auto CompositeDataTable = Cast<UCompositeDataTable>(DataTable))
if (DataTable->IsA(CompositeDataTableClass))
{

View File

@@ -1476,67 +1476,11 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
return ClientOnPawnDiedOriginal(PlayerController, DeathReport);
}
bool IsBuildingOkForEditing(ABuildingSMActor* BuildingActorToEdit)
{
// we should check if these are valid ptrs but idk if it exists on every version and im too lazy to check
static auto EditModeSupportOffset = BuildingActorToEdit->GetOffset("EditModeSupport");
static auto EditModePatternDataOffset = BuildingActorToEdit->GetOffset("EditModePatternData");
bool idkSomeAttachmentCheck = false;
if (false)
{
// again idk if this is the same for every build
static auto AttachmentPlacementBlockingActorsOffset = BuildingActorToEdit->GetOffset("AttachmentPlacementBlockingActors");
auto& AttachmentPlacementBlockingActors = BuildingActorToEdit->Get<TArray<ABuildingSMActor*>>(AttachmentPlacementBlockingActorsOffset);
// bro what
/* auto AttachmentPlacementBlockingActorsIt = *AttachmentPlacementBlockingActors.Data; // hm?
auto v3 = &AttachmentPlacementBlockingActorsIt[AttachmentPlacementBlockingActors.Num()];
if (AttachmentPlacementBlockingActors.Data == v3)
{
idkSomeAttachmentCheck = false;
}
else
{
bool bdid = false;
while (!*AttachmentPlacementBlockingActors)
{
if (++AttachmentPlacementBlockingActors == v3)
{
idkSomeAttachmentCheck = false;
bdid = true;
break;
}
}
if (!bdid)
idkSomeAttachmentCheck = true;
} */
}
// some other stuff to but too much
return BuildingActorToEdit->IsPlayerBuildable() && !idkSomeAttachmentCheck;
}
void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToEdit)
{
if (!BuildingActorToEdit || !BuildingActorToEdit->IsPlayerPlaced()) // We need more checks.
return;
if (BuildingActorToEdit->GetEditingPlayer() && BuildingActorToEdit->GetEditingPlayer() != PlayerController->GetPlayerState())
return;
if (BuildingActorToEdit->IsDestroyed() /* || !BuildingActorToEdit->GetWorld() */)
return;
if (!IsBuildingOkForEditing(BuildingActorToEdit))
return;
auto Pawn = PlayerController->GetMyFortPawn();
if (!Pawn)
@@ -1592,10 +1536,10 @@ void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame
// LOG_INFO(LogDev, "RotationIterations: {}", RotationIterations);
if (!BuildingActorToEdit /* || !BuildingActorToEdit->GetWorld() */ || BuildingActorToEdit->GetEditingPlayer() != PlayerState || BuildingActorToEdit->IsDestroyed())
if (!BuildingActorToEdit || !NewBuildingClass || BuildingActorToEdit->IsDestroyed() || BuildingActorToEdit->GetEditingPlayer() != PlayerState)
{
// LOG_INFO(LogDev, "Cheater?");
// LOG_INFO(LogDev, "BuildingActorToEdit->GetEditingPlayer(): {} PlayerState: {} NewBuildingClass: {} BuildingActorToEdit: {}", BuildingActorToEdit ? __int64(BuildingActorToEdit->GetEditingPlayer()) : -1, __int64(PlayerState), __int64(NewBuildingClass), __int64(BuildingActorToEdit));
LOG_INFO(LogDev, "Cheater?");
LOG_INFO(LogDev, "BuildingActorToEdit->GetEditingPlayer(): {} PlayerState: {} NewBuildingClass: {} BuildingActorToEdit: {}", BuildingActorToEdit ? __int64(BuildingActorToEdit->GetEditingPlayer()) : -1, __int64(PlayerState), __int64(NewBuildingClass), __int64(BuildingActorToEdit));
return ServerEditBuildingActorOriginal(Context, Stack, Ret);
}
@@ -1613,7 +1557,7 @@ void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame
BuildingActor->SetPlayerPlaced(true);
}
// we should do more things here but it might just be challenge related things
// we should do more things here
return ServerEditBuildingActorOriginal(Context, Stack, Ret);
}
@@ -1645,6 +1589,9 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl
auto EditTool = Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon());
BuildingActorToStopEditing->GetEditingPlayer() = nullptr;
// BuildingActorToStopEditing->OnRep_EditingPlayer();
if (EditTool)
{
EditTool->GetEditActor() = nullptr;

View File

@@ -550,22 +550,27 @@ std::vector<uint64> Addresses::GetFunctionsToNull()
toNull.push_back(Memcury::Scanner::FindPattern("40 55 57 41 57 48 8D 6C 24 ? 48 81 EC ? ? ? ? 80 3D ? ? ? ? ? 0F B6 FA 44 8B F9 74 3B 80 3D ? ? ? ? ? 0F").Get());
}
if (std::floor(Fortnite_Version) == 16)
{
toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 48 89 70 10 48 89 78 18 4C 89 60 20 55 41 56 41 57 48 8B EC 48 83 EC 60 49 8B D9 45 8A F8 4C 8B F2 48").Get()); // no reservation in gakme
}
if (std::floor(Fortnite_Version) == 17)
{
// toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 70 08 48 89 78 10 55 41 54 41 55 41 56 41 57 48 8D 68 A1 48 81 EC ? ? ? ? 45 33 ED").Get()); // collectgarbage
}
if (Fortnite_Version == 17.50)
{
toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 48 89 70 10 48 89 78 18 4C 89 60 20 55 41 56 41 57 48 8B EC 48 83 EC 60 49 8B D9 45 8A").Get()); // no reservation in game
}
if (Engine_Version == 500)
{
// toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 55 53 56 57 41 54 41 55 41 56 41 57 48 8D 68 A1 48 81 EC ? ? ? ? 45 33 F6 0F 29 70 A8 44 38 35").Get()); // zone
toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 55 56 57 41 54 41 55 41 56 41 57 48 8D 68 A8 48 81 EC ? ? ? ? 45").Get()); // GC
}
if (Engine_Version >= 426)
{
toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 48 89 70 10 48 89 78 18 4C 89 60 20 55 41 56 41 57 48 8B EC 48 83 EC 60 49 8B D9 45 8A").Get()); // No reserve
}
toNull.push_back(Addresses::ChangeGameSessionId);
return toNull;

View File

@@ -201,6 +201,12 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
if (bShouldUpdate)
WorldInventory->Update();
auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
auto ItemLevel = UFortLootLevel::GetItemLevel(WID->GetLootLevelData(), GameState->GetWorldLevel());
LOG_INFO(LogDev, "ItemLevel: {}", ItemLevel);
LOG_INFO(LogDev, "PickLevel: {}", WID->PickLevel(ItemLevel));
SendMessageToConsole(PlayerController, L"Granted item!");
}
else if (Command == "printsimulatelootdrops")