fix some bug with remvoing items, add experimental stat saving for gadgets, fix shadow stones scuffy
This commit is contained in:
Milxnor
2023-05-07 22:30:56 -04:00
parent 3405177d20
commit bfe2610a11
18 changed files with 281 additions and 104 deletions

View File

@@ -71,6 +71,20 @@ public:
ArrayMax = v3; ArrayMax = v3;
} }
int AddUnitialized2(SIZE_T NumBytesPerElement = sizeof(InElementType))
{
const int OldArrayNum = ArrayNum;
ArrayNum = OldArrayNum + 1;
if (ArrayNum > ArrayMax)
{
ResizeArray(ArrayNum, NumBytesPerElement);
}
return OldArrayNum;
}
void CopyFromArray(TArray<InElementType>& OtherArray, SIZE_T NumBytesPerElement = sizeof(InElementType)) void CopyFromArray(TArray<InElementType>& OtherArray, SIZE_T NumBytesPerElement = sizeof(InElementType))
{ {
if (!OtherArray.ArrayNum && !ArrayMax) if (!OtherArray.ArrayNum && !ArrayMax)
@@ -292,6 +306,18 @@ public:
return -1; return -1;
} }
void FreeGood(SizeType Size = sizeof(InElementType))
{
static void (*FreeOriginal)(void* Original) = decltype(FreeOriginal)(Addresses::Free);
if (FreeOriginal)
FreeOriginal(Data);
Data = nullptr;
ArrayNum = 0;
ArrayMax = 0;
}
void FreeReal(SizeType Size = sizeof(InElementType)) void FreeReal(SizeType Size = sizeof(InElementType))
{ {
if (!IsBadReadPtr(Data, 8) && ArrayNum > 0 && sizeof(InElementType) > 0) if (!IsBadReadPtr(Data, 8) && ArrayNum > 0 && sizeof(InElementType) > 0)

View File

@@ -33,3 +33,23 @@ struct FGameplayAttribute
return NamePrivate->ToString(); return NamePrivate->ToString();
} }
}; };
struct FGameplayAttributeData
{
float& GetBaseValue()
{
static auto BaseValueOffset = FindOffsetStruct("/Script/GameplayAbilities.GameplayAttributeData", "BaseValue");
return *(float*)(__int64(this) + BaseValueOffset);
}
float& GetCurrentValue()
{
static auto CurrentValueOffset = FindOffsetStruct("/Script/GameplayAbilities.GameplayAttributeData", "CurrentValue");
return *(float*)(__int64(this) + CurrentValueOffset);
}
};
struct FFortGameplayAttributeData : public FGameplayAttributeData
{
};

View File

@@ -45,8 +45,10 @@ static inline void SpawnBGAs() // hahah not "proper", there's a function that we
auto LootDrops = PickLootDrops(SpawnLootTierGroup, false); auto LootDrops = PickLootDrops(SpawnLootTierGroup, false);
for (auto& LootDrop : LootDrops) for (int z = 0; z < LootDrops.size(); z++)
{ {
auto& LootDrop = LootDrops.at(z);
static auto ConsumableClassOffset = LootDrop->GetItemDefinition()->GetOffset("ConsumableClass"); static auto ConsumableClassOffset = LootDrop->GetItemDefinition()->GetOffset("ConsumableClass");
auto ConsumableClassSoft = LootDrop->GetItemDefinition()->GetPtr<TSoftObjectPtr<UClass>>(ConsumableClassOffset); auto ConsumableClassSoft = LootDrop->GetItemDefinition()->GetPtr<TSoftObjectPtr<UClass>>(ConsumableClassOffset);
@@ -115,7 +117,8 @@ static inline void SpawnBGAs() // hahah not "proper", there's a function that we
// ConsumableActor->InitializeBuildingActor(nullptr, nullptr, true); // idk UFortKismetLibrary::SpawnBuildingGameplayActor does this // ConsumableActor->InitializeBuildingActor(nullptr, nullptr, true); // idk UFortKismetLibrary::SpawnBuildingGameplayActor does this
LOG_INFO(LogDev, "Spawned BGA {} at {} {} {}", ConsumableActor->GetName(), FinalSpawnTransform.Translation.X, FinalSpawnTransform.Translation.Y, FinalSpawnTransform.Translation.Z); LOG_INFO(LogDev, "[{}/{}] Spawned BGA {} at {} {} {}", z, LootDrops.size(), ConsumableActor->GetName(), FinalSpawnTransform.Translation.X, FinalSpawnTransform.Translation.Y, FinalSpawnTransform.Translation.Z);
break; // ?
} }
} }
} }

View File

@@ -132,19 +132,6 @@ std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddI
NewItemInstances.push_back(NewItemInstance); NewItemInstances.push_back(NewItemInstance);
bool bEnableStateValues = false; // Addresses::FreeEntry;
if (bEnableStateValues)
{
// FFortItemEntryStateValue* StateValue = Alloc<FFortItemEntryStateValue>(FFortItemEntryStateValue::GetStructSize(), true);
PadHexA8 StateValue{};
((FFortItemEntryStateValue*)&StateValue)->GetIntValue() = bShowItemToast;
((FFortItemEntryStateValue*)&StateValue)->GetStateType() = EFortItemEntryState::ShouldShowItemToast;
((FFortItemEntryStateValue*)&StateValue)->GetNameValue() = FName(0);
NewItemInstance->GetItemEntry()->GetStateValues().AddPtr((FFortItemEntryStateValue*)&StateValue, FFortItemEntryStateValue::GetStructSize());
}
ItemInstances.Add(NewItemInstance); ItemInstances.Add(NewItemInstance);
auto ReplicatedEntryIdx = GetItemList().GetReplicatedEntries().Add(*NewItemInstance->GetItemEntry(), FFortItemEntry::GetStructSize()); auto ReplicatedEntryIdx = GetItemList().GetReplicatedEntries().Add(*NewItemInstance->GetItemEntry(), FFortItemEntry::GetStructSize());
// GetItemList().GetReplicatedEntries().AtPtr(ReplicatedEntryIdx, FFortItemEntry::GetStructSize())->GetIsReplicatedCopy() = true; // GetItemList().GetReplicatedEntries().AtPtr(ReplicatedEntryIdx, FFortItemEntry::GetStructSize())->GetIsReplicatedCopy() = true;
@@ -273,20 +260,15 @@ bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int
int OldCount = Count; int OldCount = Count;
bool bLikeReallyForce = false;
if (Count < 0) // idk why i have this if (Count < 0) // idk why i have this
{ {
Count = 0; Count = 0;
bForceRemoval = true; bForceRemoval = true;
bLikeReallyForce = true;
} }
auto& ItemInstances = GetItemList().GetItemInstances(); auto& ItemInstances = GetItemList().GetItemInstances();
auto& ReplicatedEntries = GetItemList().GetReplicatedEntries(); auto& ReplicatedEntries = GetItemList().GetReplicatedEntries();
if (!bLikeReallyForce)
{
auto NewCount = ReplicatedEntry->GetCount() - Count; auto NewCount = ReplicatedEntry->GetCount() - Count;
bool bOverrideChangeStackSize = false; bool bOverrideChangeStackSize = false;
@@ -326,10 +308,6 @@ bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int
if (NewCount < 0) // Hm if (NewCount < 0) // Hm
return false; return false;
}
static auto FortItemEntryStruct = FindObject<UStruct>(L"/Script/FortniteGame.FortItemEntry");
static auto FortItemEntrySize = FortItemEntryStruct->GetPropertiesSize();
auto FortPlayerController = Cast<AFortPlayerController>(GetOwner()); auto FortPlayerController = Cast<AFortPlayerController>(GetOwner());
@@ -368,10 +346,10 @@ bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int
for (int i = 0; i < ReplicatedEntries.Num(); i++) for (int i = 0; i < ReplicatedEntries.Num(); i++)
{ {
if (ReplicatedEntries.at(i, FortItemEntrySize).GetItemGuid() == ItemGuid) if (ReplicatedEntries.at(i, FFortItemEntry::GetStructSize()).GetItemGuid() == ItemGuid)
{ {
FFortItemEntry::FreeItemEntry(ReplicatedEntries.AtPtr(i, FortItemEntrySize)); FFortItemEntry::FreeItemEntry(ReplicatedEntries.AtPtr(i, FFortItemEntry::GetStructSize()));
ReplicatedEntries.Remove(i, FortItemEntrySize); ReplicatedEntries.Remove(i, FFortItemEntry::GetStructSize());
break; break;
} }
} }

View File

@@ -9,6 +9,8 @@
#include "reboot.h" #include "reboot.h"
#define REMOVE_ALL_ITEMS -1
static bool IsPrimaryQuickbar(UFortItemDefinition* ItemDefinition) static bool IsPrimaryQuickbar(UFortItemDefinition* ItemDefinition)
{ {
/* if (ItemDefinition->IsA(UFortDecoItemDefinition::StaticClass())) /* if (ItemDefinition->IsA(UFortDecoItemDefinition::StaticClass()))

View File

@@ -1,11 +1,34 @@
#include "FortItem.h" #include "FortItem.h"
#include "FortWeaponItemDefinition.h" #include "FortWeaponItemDefinition.h"
#include "AbilitySystemComponent.h"
void FFortItemEntry::SetStateValue(EFortItemEntryState StateType, int IntValue)
{
for (int i = 0; i < GetStateValues().Num(); i++)
{
if (GetStateValues().at(i).GetStateType() == StateType)
{
GetStateValues().at(i).GetIntValue() = IntValue;
return;
}
}
auto idx = GetStateValues().AddUnitialized2(FFortItemEntryStateValue::GetStructSize());
GetStateValues().AtPtr(idx, FFortItemEntryStateValue::GetStructSize())->GetIntValue() = IntValue;
GetStateValues().AtPtr(idx, FFortItemEntryStateValue::GetStructSize())->GetStateType() = StateType;
GetStateValues().AtPtr(idx, FFortItemEntryStateValue::GetStructSize())->GetNameValue() = FName(0);
// idk some parentinventory stuff here
// ItemEntry->bIsDirty = true;
}
FFortItemEntry* FFortItemEntry::MakeItemEntry(UFortItemDefinition* ItemDefinition, int Count, int LoadedAmmo, float Durability) FFortItemEntry* FFortItemEntry::MakeItemEntry(UFortItemDefinition* ItemDefinition, int Count, int LoadedAmmo, float Durability)
{ {
auto Entry = // (FFortItemEntry*)FMemory::Realloc(0, GetStructSize(), 0); bool bUseFMemoryRealloc = false; // I don't think this works because sometimes we don't free it (oops).
Alloc<FFortItemEntry>(GetStructSize()); auto Entry = Alloc<FFortItemEntry>(GetStructSize(), bUseFMemoryRealloc);
if (!Entry) if (!Entry)
return nullptr; return nullptr;

View File

@@ -161,16 +161,11 @@ struct FFortItemEntry : FFastArraySerializerItem
if (GenericAttributeValuesOffset != -1) if (GenericAttributeValuesOffset != -1)
{ {
// proper copying
this->GetGenericAttributeValues().CopyFromArray(OtherItemEntry->GetGenericAttributeValues()); this->GetGenericAttributeValues().CopyFromArray(OtherItemEntry->GetGenericAttributeValues());
/* for (int i = 0; i < OtherItemEntry->GetGenericAttributeValues().Num(); i++)
{
this->GetGenericAttributeValues().Add(OtherItemEntry->GetGenericAttributeValues().at(i));
} */
} }
this->GetStateValues().CopyFromArray(OtherItemEntry->GetStateValues(), FFortItemEntryStateValue::GetStructSize());
// should we do this? // should we do this?
this->MostRecentArrayReplicationKey = -1; this->MostRecentArrayReplicationKey = -1;
@@ -178,6 +173,8 @@ struct FFortItemEntry : FFastArraySerializerItem
this->ReplicationKey = -1; this->ReplicationKey = -1;
} }
void SetStateValue(EFortItemEntryState StateType, int IntValue);
static UStruct* GetStruct() static UStruct* GetStruct()
{ {
static auto Struct = FindObject<UStruct>("/Script/FortniteGame.FortItemEntry"); static auto Struct = FindObject<UStruct>("/Script/FortniteGame.FortItemEntry");
@@ -207,13 +204,13 @@ struct FFortItemEntry : FFastArraySerializerItem
if (GenericAttributeValuesOffset != -1) if (GenericAttributeValuesOffset != -1)
{ {
Entry->GetGenericAttributeValues().Free(); Entry->GetGenericAttributeValues().FreeGood();
} }
Entry->GetStateValues().Free(); Entry->GetStateValues().FreeGood();
} }
RtlZeroMemory(Entry, FFortItemEntry::GetStructSize()); // RtlZeroMemory(Entry, FFortItemEntry::GetStructSize());
} }
static void FreeArrayOfEntries(TArray<FFortItemEntry>& tarray) static void FreeArrayOfEntries(TArray<FFortItemEntry>& tarray)

View File

@@ -64,6 +64,8 @@ AFortPickup* AFortPickup::SpawnPickup(PickupCreateData& PickupData)
if (Addresses::PickupInitialize) if (Addresses::PickupInitialize)
{ {
// Honestly this is the god function, it automatically handles special actors and automatically adds to state values, who else knows what it does.
static void (*SetupPickup)(AFortPickup* Pickup, __int64 ItemEntry, TArray<FFortItemEntry> MultiItemPickupEntriesIGuess, bool bSplitOnPickup) static void (*SetupPickup)(AFortPickup* Pickup, __int64 ItemEntry, TArray<FFortItemEntry> MultiItemPickupEntriesIGuess, bool bSplitOnPickup)
= decltype(SetupPickup)(Addresses::PickupInitialize); = decltype(SetupPickup)(Addresses::PickupInitialize);

View File

@@ -82,7 +82,7 @@ struct PickupCreateData
{ {
if (bShouldFreeItemEntryWhenDeconstructed) if (bShouldFreeItemEntryWhenDeconstructed)
{ {
// real
} }
} }
}; };

View File

@@ -848,7 +848,7 @@ void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFra
bool bBuildFree = PlayerController->DoesBuildFree(); bool bBuildFree = PlayerController->DoesBuildFree();
LOG_INFO(LogDev, "MatInstance->GetItemEntry()->GetCount(): {}", MatInstance->GetItemEntry()->GetCount()); // LOG_INFO(LogDev, "MatInstance->GetItemEntry()->GetCount(): {}", MatInstance->GetItemEntry()->GetCount());
bool bShouldDestroy = MatInstance && MatInstance->GetItemEntry() ? MatInstance->GetItemEntry()->GetCount() < 10 : true; bool bShouldDestroy = MatInstance && MatInstance->GetItemEntry() ? MatInstance->GetItemEntry()->GetCount() < 10 : true;
@@ -977,25 +977,73 @@ void AFortPlayerController::ServerAttemptInventoryDropHook(AFortPlayerController
if (!ItemDefinition->ShouldIgnoreRespawningOnDrop() && (DropBehaviorOffset != -1 ? ItemDefinition->GetDropBehavior() != EWorldItemDropBehavior::DestroyOnDrop : true)) if (!ItemDefinition->ShouldIgnoreRespawningOnDrop() && (DropBehaviorOffset != -1 ? ItemDefinition->GetDropBehavior() != EWorldItemDropBehavior::DestroyOnDrop : true))
{ {
/* if (auto GadgetItemDefintiion = Cast<UFortGadgetItemDefinition>(ItemDefinition)) if (false)
{ {
for (int i = 0; i < GadgetItemDefintiion->GetTrackedAttributes().Num(); i++) if (auto GadgetItemDefinition = Cast<UFortGadgetItemDefinition>(ItemDefinition))
{ {
LOG_INFO(LogDev, "[{}] TrackedAttribute Attribute Name {}", i, GadgetItemDefintiion->GetTrackedAttributes().at(i).GetAttributePropertyName()); auto PlayerState = Cast<AFortPlayerState>(PlayerController->GetPlayerState());
auto ASC = PlayerState->GetAbilitySystemComponent();
PadHexA8 StateValue{}; // Alloc<FFortItemEntryStateValue>(FFortItemEntryStateValue::GetStructSize(), true); if (GadgetItemDefinition->GetTrackedAttributes().Num() > 0)
((FFortItemEntryStateValue*)&StateValue)->GetIntValue() = 1; {
((FFortItemEntryStateValue*)&StateValue)->GetStateType() = EFortItemEntryState::GenericAttributeValueSet; ReplicatedEntry->SetStateValue(EFortItemEntryState::GenericAttributeValueSet, 1);
((FFortItemEntryStateValue*)&StateValue)->GetNameValue() = FName(0);
ReplicatedEntry->GetStateValues().AddPtr((FFortItemEntryStateValue*)&StateValue, FFortItemEntryStateValue::GetStructSize());
ReplicatedEntry->GetGenericAttributeValues().Add(9);
} }
} */
auto Pickup = AFortPickup::SpawnPickup(ReplicatedEntry, Pawn->GetActorLocation(), std::vector<float> AttributeValueVector;
EFortPickupSourceTypeFlag::GetPlayerValue(), 0, Pawn, nullptr, true, Count);
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());
auto AbilitySystemComponent = PlayerState->GetAbilitySystemComponent();
int CurrentAttributeValue = -1;
for (int i = 0; i < AbilitySystemComponent->GetSpawnedAttributes().Num(); i++)
{
auto CurrentSpawnedAttribute = AbilitySystemComponent->GetSpawnedAttributes().at(i);
if (CurrentSpawnedAttribute->IsA(CurrentTrackedAttribute.AttributeOwner))
{
auto PropertyOffset = CurrentSpawnedAttribute->GetOffset(CurrentTrackedAttribute.GetAttributePropertyName());
if (PropertyOffset != -1)
{
CurrentAttributeValue = CurrentSpawnedAttribute->GetPtr<FFortGameplayAttributeData>(PropertyOffset)->GetCurrentValue();
break; // hm
}
}
}
// LOG_INFO(LogDev, "CurrentAttributeValue: {}", CurrentAttributeValue);
if (CurrentAttributeValue != -1) // Found the attribute.
{
// im so smart
AttributeValueVector.push_back(CurrentAttributeValue);
}
}
for (int z = 0; z < ReplicatedEntry->GetGenericAttributeValues().Num(); z++) // First value must be the current value // dont ask me why fortnite keeps the old values in it too..
{
AttributeValueVector.push_back(ReplicatedEntry->GetGenericAttributeValues().at(z));
}
ReplicatedEntry->GetGenericAttributeValues().Free();
for (auto& AttributeValue : AttributeValueVector)
{
ReplicatedEntry->GetGenericAttributeValues().Add(AttributeValue);
}
}
}
auto Pickup = AFortPickup::SpawnPickup(ReplicatedEntry, Pawn->GetActorLocation(), EFortPickupSourceTypeFlag::GetPlayerValue(), 0, Pawn, nullptr, true, Count);
if (!Pickup) if (!Pickup)
return; return;
@@ -1337,7 +1385,6 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
if (WorldInventory) if (WorldInventory)
{ {
auto& ItemInstances = WorldInventory->GetItemList().GetItemInstances(); auto& ItemInstances = WorldInventory->GetItemList().GetItemInstances();
std::vector<std::pair<FGuid, int>> GuidAndCountsToRemove; std::vector<std::pair<FGuid, int>> GuidAndCountsToRemove;

View File

@@ -46,9 +46,12 @@ void AFortPlayerControllerAthena::StartGhostModeHook(UObject* Context, FFrame* S
auto PickaxeInstance = WorldInventory->GetPickaxeInstance(); auto PickaxeInstance = WorldInventory->GetPickaxeInstance();
// LOG_INFO(LogDev, "PickaxeInstance: {}", __int64(PickaxeInstance));
if (PickaxeInstance) if (PickaxeInstance)
{ {
WorldInventory->RemoveItem(PickaxeInstance->GetItemEntry()->GetItemGuid(), nullptr, PickaxeInstance->GetItemEntry()->GetCount(), true); WorldInventory->RemoveItem(PickaxeInstance->GetItemEntry()->GetItemGuid(), nullptr, REMOVE_ALL_ITEMS, true);
// WorldInventory->Update();
} }
bool bShouldUpdate = false; bool bShouldUpdate = false;
@@ -61,6 +64,9 @@ void AFortPlayerControllerAthena::StartGhostModeHook(UObject* Context, FFrame* S
// if (bShouldUpdate) // if (bShouldUpdate)
WorldInventory->Update(); WorldInventory->Update();
PlayerController->AddPickaxeToInventory();
WorldInventory->Update();
PlayerController->ServerExecuteInventoryItemHook(PlayerController, GhostModeItemInstance->GetItemEntry()->GetItemGuid()); PlayerController->ServerExecuteInventoryItemHook(PlayerController, GhostModeItemInstance->GetItemEntry()->GetItemGuid());
PlayerController->ClientEquipItem(GhostModeItemInstance->GetItemEntry()->GetItemGuid(), true); PlayerController->ClientEquipItem(GhostModeItemInstance->GetItemEntry()->GetItemGuid(), true);
LOG_INFO(LogDev, "Finished!"); LOG_INFO(LogDev, "Finished!");
@@ -103,16 +109,10 @@ void AFortPlayerControllerAthena::EndGhostModeHook(AFortPlayerControllerAthena*
return EndGhostModeOriginal(PlayerController); return EndGhostModeOriginal(PlayerController);
auto PickaxeInstance = PlayerController->AddPickaxeToInventory(); auto PickaxeInstance = PlayerController->AddPickaxeToInventory();
WorldInventory->Update();
WorldInventory->ForceNetUpdate(); WorldInventory->ForceNetUpdate();
PlayerController->ForceNetUpdate(); PlayerController->ForceNetUpdate();
if (PickaxeInstance)
{
PlayerController->ClientEquipItem(PickaxeInstance->GetItemEntry()->GetItemGuid(), true);
}
bool bShouldUpdate = false; bool bShouldUpdate = false;
int Count = GhostModeItemInstance->GetItemEntry()->GetCount(); // 1 int Count = GhostModeItemInstance->GetItemEntry()->GetCount(); // 1
bool bForceRemoval = true; // false bool bForceRemoval = true; // false
@@ -121,6 +121,11 @@ void AFortPlayerControllerAthena::EndGhostModeHook(AFortPlayerControllerAthena*
// if (bShouldUpdate) // if (bShouldUpdate)
WorldInventory->Update(); WorldInventory->Update();
if (PickaxeInstance)
{
PlayerController->ClientEquipItem(PickaxeInstance->GetItemEntry()->GetItemGuid(), true);
}
return EndGhostModeOriginal(PlayerController); return EndGhostModeOriginal(PlayerController);
} }

View File

@@ -155,7 +155,7 @@ UPackage* UObject::GetOutermost() const
} }
} }
bool UObject::IsA(UClass* otherClass) bool UObject::IsA(UStruct* otherClass)
{ {
UClass* super = ClassPrivate; UClass* super = ClassPrivate;

View File

@@ -57,7 +57,7 @@ public:
FName GetFName() const { return NamePrivate; } FName GetFName() const { return NamePrivate; }
class UPackage* GetOutermost() const; class UPackage* GetOutermost() const;
bool IsA(UClass* Other); bool IsA(class UStruct* Other);
class UFunction* FindFunction(const std::string& ShortFunctionName); class UFunction* FindFunction(const std::string& ShortFunctionName);
void* GetProperty(const std::string& ChildName, bool bWarnIfNotFound = true); void* GetProperty(const std::string& ChildName, bool bWarnIfNotFound = true);

View File

@@ -118,9 +118,6 @@
<ClCompile Include="FortPlaysetItemDefinition.cpp"> <ClCompile Include="FortPlaysetItemDefinition.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter> <Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="FortWeaponItemDefinition.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter>
</ClCompile>
<ClCompile Include="FortInventoryInterface.cpp"> <ClCompile Include="FortInventoryInterface.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter> <Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter>
</ClCompile> </ClCompile>
@@ -268,6 +265,9 @@
<ClCompile Include="FortAthenaMapInfo.cpp"> <ClCompile Include="FortAthenaMapInfo.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private</Filter> <Filter>FortniteGame\Source\FortniteGame\Private</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="FortWeaponItemDefinition.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="log.h" /> <ClInclude Include="log.h" />

View File

@@ -190,7 +190,7 @@ namespace Bots
auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState()); auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode()); auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
auto AllBuildingContainers = UGameplayStatics::GetAllActorsOfClass(GetWorld(), ABuildingContainer::StaticClass()); // auto AllBuildingContainers = UGameplayStatics::GetAllActorsOfClass(GetWorld(), ABuildingContainer::StaticClass());
// for (int i = 0; i < GameMode->GetAlivePlayers().Num(); i++) // for (int i = 0; i < GameMode->GetAlivePlayers().Num(); i++)
for (auto& PlayerBot : AllPlayerBotsToTick) for (auto& PlayerBot : AllPlayerBotsToTick)
@@ -243,6 +243,6 @@ namespace Bots
} */ } */
} }
AllBuildingContainers.Free(); // AllBuildingContainers.Free();
} }
} }

View File

@@ -221,6 +221,75 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
SendMessageToConsole(PlayerController, L"Printed!"); SendMessageToConsole(PlayerController, L"Printed!");
} }
/* else if (Command == "debugattributes")
{
auto AbilitySystemComponent = ReceivingPlayerState->GetAbilitySystemComponent();
if (!AbilitySystemComponent)
{
SendMessageToConsole(PlayerController, L"No AbilitySystemComponent!");
return;
}
SendMessageToConsole(PlayerController, (L"AbilitySystemComponent->GetSpawnedAttributes().Num(): " + std::to_wstring(AbilitySystemComponent->GetSpawnedAttributes().Num())).c_str());
for (int i = 0; i < AbilitySystemComponent->GetSpawnedAttributes().Num(); i++)
{
auto CurrentAttributePathName = AbilitySystemComponent->GetSpawnedAttributes().at(i)->GetPathName();
SendMessageToConsole(PlayerController, (L"SpawnedAttribute Name: " + std::wstring(CurrentAttributePathName.begin(), CurrentAttributePathName.end())).c_str());
}
}
else if (Command == "debugcurrentitem")
{
auto Pawn = ReceivingController->GetMyFortPawn();
if (!Pawn)
{
SendMessageToConsole(PlayerController, L"No pawn!");
return;
}
auto CurrentWeapon = Pawn->GetCurrentWeapon();
if (!CurrentWeapon)
{
SendMessageToConsole(PlayerController, L"No CurrentWeapon!");
return;
}
auto WorldInventory = ReceivingController->GetWorldInventory();
if (!CurrentWeapon)
{
SendMessageToConsole(PlayerController, L"No WorldInventory!");
return;
}
auto ItemInstance = WorldInventory->FindItemInstance(CurrentWeapon->GetItemEntryGuid());
auto ReplicatedEntry = WorldInventory->FindReplicatedEntry(CurrentWeapon->GetItemEntryGuid());
if (!ItemInstance)
{
SendMessageToConsole(PlayerController, L"Failed to find ItemInstance!");
return;
}
if (!ReplicatedEntry)
{
SendMessageToConsole(PlayerController, L"Failed to find ReplicatedEntry!");
return;
}
SendMessageToConsole(PlayerController, (L"ReplicatedEntry->GetGenericAttributeValues().Num(): " + std::to_wstring(ReplicatedEntry->GetGenericAttributeValues().Num())).c_str());
SendMessageToConsole(PlayerController, (L"ReplicatedEntry->GetStateValues().Num(): " + std::to_wstring(ReplicatedEntry->GetStateValues().Num())).c_str());
for (int i = 0; i < ReplicatedEntry->GetStateValues().Num(); i++)
{
SendMessageToConsole(PlayerController, (L"[{}] StateValue Type: "
+ std::to_wstring((int)ReplicatedEntry->GetStateValues().at(i, FFortItemEntryStateValue::GetStructSize()).GetStateType())).c_str()
);
}
} */
else if (Command == "setpickaxe") else if (Command == "setpickaxe")
{ {
if (NumArgs < 1) if (NumArgs < 1)

View File

@@ -493,7 +493,7 @@ DWORD WINAPI Main(LPVOID)
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerZone.ServerRequestSeatChange"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerZone.ServerRequestSeatChange"),
AFortPlayerControllerAthena::ServerRequestSeatChangeHook, (PVOID*)&AFortPlayerControllerAthena::ServerRequestSeatChangeOriginal, false); AFortPlayerControllerAthena::ServerRequestSeatChangeHook, (PVOID*)&AFortPlayerControllerAthena::ServerRequestSeatChangeOriginal, false);
if (false) // if (false)
{ {
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerGameplay.StartGhostMode"), // (Milxnor) TODO: This changes to a component in later seasons. Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerGameplay.StartGhostMode"), // (Milxnor) TODO: This changes to a component in later seasons.
AFortPlayerControllerAthena::StartGhostModeHook, (PVOID*)&AFortPlayerControllerAthena::StartGhostModeOriginal, false, true); // We can exec hook since it only gets called via blueprint. AFortPlayerControllerAthena::StartGhostModeHook, (PVOID*)&AFortPlayerControllerAthena::StartGhostModeOriginal, false, true); // We can exec hook since it only gets called via blueprint.
@@ -578,8 +578,8 @@ DWORD WINAPI Main(LPVOID)
AFortPawn::NetMulticast_Athena_BatchedDamageCuesHook, (PVOID*)&AFortPawn::NetMulticast_Athena_BatchedDamageCuesOriginal, false, true); AFortPawn::NetMulticast_Athena_BatchedDamageCuesHook, (PVOID*)&AFortPawn::NetMulticast_Athena_BatchedDamageCuesOriginal, false, true);
Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPawn.MovingEmoteStopped"), Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPawn.MovingEmoteStopped"),
AFortPawn::MovingEmoteStoppedHook, (PVOID*)&AFortPawn::MovingEmoteStoppedOriginal, false, true); AFortPawn::MovingEmoteStoppedHook, (PVOID*)&AFortPawn::MovingEmoteStoppedOriginal, false, true);
Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawnAthena.OnCapsuleBeginOverlap") ? FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawnAthena.OnCapsuleBeginOverlap") : FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawn.OnCapsuleBeginOverlap"), // Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawnAthena.OnCapsuleBeginOverlap") ? FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawnAthena.OnCapsuleBeginOverlap") : FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawn.OnCapsuleBeginOverlap"),
AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook, (PVOID*)&AFortPlayerPawnAthena::OnCapsuleBeginOverlapOriginal, false, true); // AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook, (PVOID*)&AFortPlayerPawnAthena::OnCapsuleBeginOverlapOriginal, false, true);
Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_RemoveFortItemFromPlayer"), Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_RemoveFortItemFromPlayer"),
UFortKismetLibrary::K2_RemoveFortItemFromPlayerHook, (PVOID*)&UFortKismetLibrary::K2_RemoveFortItemFromPlayerOriginal, false, true); UFortKismetLibrary::K2_RemoveFortItemFromPlayerHook, (PVOID*)&UFortKismetLibrary::K2_RemoveFortItemFromPlayerOriginal, false, true);

View File

@@ -424,7 +424,12 @@ static inline uint64 FindGetPlayerViewpoint()
static inline uint64 FindFree() static inline uint64 FindFree()
{ {
auto addr = Memcury::Scanner::FindPattern("48 85 C9 74 2E 53 48 83 EC 20 48 8B D9").Get(); return 0;
uint64 addr = 0;
if (Engine_Version >= 421 && Engine_Version <= 423)
addr = Memcury::Scanner::FindPattern("48 85 C9 74 2E 53 48 83 EC 20 48 8B D9").Get();
return addr; return addr;
} }