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;
}
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))
{
if (!OtherArray.ArrayNum && !ArrayMax)
@@ -292,6 +306,18 @@ public:
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))
{
if (!IsBadReadPtr(Data, 8) && ArrayNum > 0 && sizeof(InElementType) > 0)

View File

@@ -32,4 +32,24 @@ struct FGameplayAttribute
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);
for (auto& LootDrop : LootDrops)
for (int z = 0; z < LootDrops.size(); z++)
{
auto& LootDrop = LootDrops.at(z);
static auto ConsumableClassOffset = LootDrop->GetItemDefinition()->GetOffset("ConsumableClass");
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
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);
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);
auto ReplicatedEntryIdx = GetItemList().GetReplicatedEntries().Add(*NewItemInstance->GetItemEntry(), FFortItemEntry::GetStructSize());
// GetItemList().GetReplicatedEntries().AtPtr(ReplicatedEntryIdx, FFortItemEntry::GetStructSize())->GetIsReplicatedCopy() = true;
@@ -273,63 +260,54 @@ bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int
int OldCount = Count;
bool bLikeReallyForce = false;
if (Count < 0) // idk why i have this
{
Count = 0;
bForceRemoval = true;
bLikeReallyForce = true;
}
auto& ItemInstances = GetItemList().GetItemInstances();
auto& ReplicatedEntries = GetItemList().GetReplicatedEntries();
if (!bLikeReallyForce)
auto NewCount = ReplicatedEntry->GetCount() - Count;
bool bOverrideChangeStackSize = false;
if (ItemDefinition->ShouldPersistWhenFinalStackEmpty())
{
auto NewCount = ReplicatedEntry->GetCount() - Count;
bool bIsFinalStack = true;
bool bOverrideChangeStackSize = false;
if (ItemDefinition->ShouldPersistWhenFinalStackEmpty())
for (int i = 0; i < ItemInstances.Num(); i++)
{
bool bIsFinalStack = true;
auto ItemInstance = ItemInstances.at(i);
for (int i = 0; i < ItemInstances.Num(); i++)
if (ItemInstance->GetItemEntry()->GetItemDefinition() == ItemDefinition && ItemInstance->GetItemEntry()->GetItemGuid() != ItemGuid)
{
auto ItemInstance = ItemInstances.at(i);
if (ItemInstance->GetItemEntry()->GetItemDefinition() == ItemDefinition && ItemInstance->GetItemEntry()->GetItemGuid() != ItemGuid)
{
bIsFinalStack = false;
break;
}
}
if (bIsFinalStack)
{
NewCount = NewCount < 0 ? 0 : NewCount; // min(NewCount, 0) or something i forgot
bOverrideChangeStackSize = true;
bIsFinalStack = false;
break;
}
}
if (OldCount != -1 && (NewCount > 0 || bOverrideChangeStackSize))
if (bIsFinalStack)
{
ItemInstance->GetItemEntry()->GetCount() = NewCount;
ReplicatedEntry->GetCount() = NewCount;
GetItemList().MarkItemDirty(ItemInstance->GetItemEntry());
GetItemList().MarkItemDirty(ReplicatedEntry);
return true;
NewCount = NewCount < 0 ? 0 : NewCount; // min(NewCount, 0) or something i forgot
bOverrideChangeStackSize = true;
}
if (NewCount < 0) // Hm
return false;
}
static auto FortItemEntryStruct = FindObject<UStruct>(L"/Script/FortniteGame.FortItemEntry");
static auto FortItemEntrySize = FortItemEntryStruct->GetPropertiesSize();
if (OldCount != -1 && (NewCount > 0 || bOverrideChangeStackSize))
{
ItemInstance->GetItemEntry()->GetCount() = NewCount;
ReplicatedEntry->GetCount() = NewCount;
GetItemList().MarkItemDirty(ItemInstance->GetItemEntry());
GetItemList().MarkItemDirty(ReplicatedEntry);
return true;
}
if (NewCount < 0) // Hm
return false;
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++)
{
if (ReplicatedEntries.at(i, FortItemEntrySize).GetItemGuid() == ItemGuid)
if (ReplicatedEntries.at(i, FFortItemEntry::GetStructSize()).GetItemGuid() == ItemGuid)
{
FFortItemEntry::FreeItemEntry(ReplicatedEntries.AtPtr(i, FortItemEntrySize));
ReplicatedEntries.Remove(i, FortItemEntrySize);
FFortItemEntry::FreeItemEntry(ReplicatedEntries.AtPtr(i, FFortItemEntry::GetStructSize()));
ReplicatedEntries.Remove(i, FFortItemEntry::GetStructSize());
break;
}
}

View File

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

View File

@@ -1,11 +1,34 @@
#include "FortItem.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)
{
auto Entry = // (FFortItemEntry*)FMemory::Realloc(0, GetStructSize(), 0);
Alloc<FFortItemEntry>(GetStructSize());
bool bUseFMemoryRealloc = false; // I don't think this works because sometimes we don't free it (oops).
auto Entry = Alloc<FFortItemEntry>(GetStructSize(), bUseFMemoryRealloc);
if (!Entry)
return nullptr;

View File

@@ -160,17 +160,12 @@ struct FFortItemEntry : FFastArraySerializerItem
static auto GenericAttributeValuesOffset = FindOffsetStruct("/Script/FortniteGame.FortItemEntry", "GenericAttributeValues", false);
if (GenericAttributeValuesOffset != -1)
{
// proper copying
{
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?
this->MostRecentArrayReplicationKey = -1;
@@ -178,6 +173,8 @@ struct FFortItemEntry : FFastArraySerializerItem
this->ReplicationKey = -1;
}
void SetStateValue(EFortItemEntryState StateType, int IntValue);
static UStruct* GetStruct()
{
static auto Struct = FindObject<UStruct>("/Script/FortniteGame.FortItemEntry");
@@ -207,13 +204,13 @@ struct FFortItemEntry : FFastArraySerializerItem
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)

View File

@@ -64,7 +64,9 @@ AFortPickup* AFortPickup::SpawnPickup(PickupCreateData& PickupData)
if (Addresses::PickupInitialize)
{
static void (*SetupPickup)(AFortPickup * Pickup, __int64 ItemEntry, TArray<FFortItemEntry> MultiItemPickupEntriesIGuess, bool bSplitOnPickup)
// 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)
= decltype(SetupPickup)(Addresses::PickupInitialize);
TArray<FFortItemEntry> MultiItemPickupEntriesIGuess{};

View File

@@ -24,7 +24,7 @@ namespace EFortPickupSourceTypeFlag
return ContainerValue;
}
static inline int64 GetFloorLootValue()
static inline int64 GetFloorLootValue()
{
static auto FloorLootValue = GetEnum() ? GetEnum()->GetValue("FloorLoot") : -1;
return FloorLootValue;
@@ -82,7 +82,7 @@ struct PickupCreateData
{
if (bShouldFreeItemEntryWhenDeconstructed)
{
// real
}
}
};

View File

@@ -848,7 +848,7 @@ void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFra
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;
@@ -977,25 +977,73 @@ void AFortPlayerController::ServerAttemptInventoryDropHook(AFortPlayerController
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);
((FFortItemEntryStateValue*)&StateValue)->GetIntValue() = 1;
((FFortItemEntryStateValue*)&StateValue)->GetStateType() = EFortItemEntryState::GenericAttributeValueSet;
((FFortItemEntryStateValue*)&StateValue)->GetNameValue() = FName(0);
if (GadgetItemDefinition->GetTrackedAttributes().Num() > 0)
{
ReplicatedEntry->SetStateValue(EFortItemEntryState::GenericAttributeValueSet, 1);
}
ReplicatedEntry->GetStateValues().AddPtr((FFortItemEntryStateValue*)&StateValue, FFortItemEntryStateValue::GetStructSize());
std::vector<float> AttributeValueVector;
ReplicatedEntry->GetGenericAttributeValues().Add(9);
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);
auto Pickup = AFortPickup::SpawnPickup(ReplicatedEntry, Pawn->GetActorLocation(), EFortPickupSourceTypeFlag::GetPlayerValue(), 0, Pawn, nullptr, true, Count);
if (!Pickup)
return;
@@ -1337,7 +1385,6 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
if (WorldInventory)
{
auto& ItemInstances = WorldInventory->GetItemList().GetItemInstances();
std::vector<std::pair<FGuid, int>> GuidAndCountsToRemove;

View File

@@ -46,9 +46,12 @@ void AFortPlayerControllerAthena::StartGhostModeHook(UObject* Context, FFrame* S
auto PickaxeInstance = WorldInventory->GetPickaxeInstance();
// LOG_INFO(LogDev, "PickaxeInstance: {}", __int64(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;
@@ -59,7 +62,10 @@ void AFortPlayerControllerAthena::StartGhostModeHook(UObject* Context, FFrame* S
return StartGhostModeOriginal(Context, Stack, Ret);
// if (bShouldUpdate)
WorldInventory->Update();
WorldInventory->Update();
PlayerController->AddPickaxeToInventory();
WorldInventory->Update();
PlayerController->ServerExecuteInventoryItemHook(PlayerController, GhostModeItemInstance->GetItemEntry()->GetItemGuid());
PlayerController->ClientEquipItem(GhostModeItemInstance->GetItemEntry()->GetItemGuid(), true);
@@ -103,23 +109,22 @@ void AFortPlayerControllerAthena::EndGhostModeHook(AFortPlayerControllerAthena*
return EndGhostModeOriginal(PlayerController);
auto PickaxeInstance = PlayerController->AddPickaxeToInventory();
WorldInventory->Update();
WorldInventory->ForceNetUpdate();
PlayerController->ForceNetUpdate();
if (PickaxeInstance)
{
PlayerController->ClientEquipItem(PickaxeInstance->GetItemEntry()->GetItemGuid(), true);
}
bool bShouldUpdate = false;
int Count = GhostModeItemInstance->GetItemEntry()->GetCount(); // 1
bool bForceRemoval = true; // false
WorldInventory->RemoveItem(GhostModeItemInstance->GetItemEntry()->GetItemGuid(), &bShouldUpdate, Count, bForceRemoval);
// if (bShouldUpdate)
WorldInventory->Update();
WorldInventory->Update();
if (PickaxeInstance)
{
PlayerController->ClientEquipItem(PickaxeInstance->GetItemEntry()->GetItemGuid(), true);
}
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;

View File

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

View File

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

View File

@@ -190,7 +190,7 @@ namespace Bots
auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
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 (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!");
}
/* 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")
{
if (NumArgs < 1)

View File

@@ -493,7 +493,7 @@ DWORD WINAPI Main(LPVOID)
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerZone.ServerRequestSeatChange"),
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.
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);
Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPawn.MovingEmoteStopped"),
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"),
AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook, (PVOID*)&AFortPlayerPawnAthena::OnCapsuleBeginOverlapOriginal, 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"),
// AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook, (PVOID*)&AFortPlayerPawnAthena::OnCapsuleBeginOverlapOriginal, false, true);
Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_RemoveFortItemFromPlayer"),
UFortKismetLibrary::K2_RemoveFortItemFromPlayerHook, (PVOID*)&UFortKismetLibrary::K2_RemoveFortItemFromPlayerOriginal, false, true);

View File

@@ -424,7 +424,12 @@ static inline uint64 FindGetPlayerViewpoint()
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;
}