mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 10:52:22 +01:00
fixed s6, added pickup notifications
This commit is contained in:
@@ -198,6 +198,19 @@ public:
|
|||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void FreeReal()
|
||||||
|
{
|
||||||
|
if (Data && ArrayNum > 0 && sizeof(InElementType) > 0)
|
||||||
|
{
|
||||||
|
// VirtualFree(Data, _msize(Data), MEM_RELEASE);
|
||||||
|
// VirtualFree(Data, sizeof(InElementType) * ArrayNum, MEM_RELEASE); // ik this does nothing
|
||||||
|
VirtualFree(Data, 0, MEM_RELEASE);
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayNum = 0;
|
||||||
|
ArrayMax = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void Free()
|
void Free()
|
||||||
{
|
{
|
||||||
if (Data && ArrayNum > 0 && sizeof(InElementType) > 0)
|
if (Data && ArrayNum > 0 && sizeof(InElementType) > 0)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ UFortItem* CreateItemInstance(AFortPlayerController* PlayerController, UFortItem
|
|||||||
return NewItemInstance;
|
return NewItemInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddItem(UFortItemDefinition* ItemDefinition, bool* bShouldUpdate, int Count, int LoadedAmmo, bool bShouldAddToStateValues)
|
std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddItem(UFortItemDefinition* ItemDefinition, bool* bShouldUpdate, int Count, int LoadedAmmo, bool bShowItemToast)
|
||||||
{
|
{
|
||||||
if (!ItemDefinition)
|
if (!ItemDefinition)
|
||||||
return std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>>();
|
return std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>>();
|
||||||
@@ -71,22 +71,21 @@ std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddI
|
|||||||
CurrentEntry->GetCount() += AmountToStack;
|
CurrentEntry->GetCount() += AmountToStack;
|
||||||
ReplicatedEntry->GetCount() += AmountToStack;
|
ReplicatedEntry->GetCount() += AmountToStack;
|
||||||
|
|
||||||
// std::cout << std::format("{} : {} : {}\n", CurrentEntry.Count, ReplicatedEntry->Count, OverStack);
|
for (int p = 0; p < CurrentEntry->GetStateValues().Num(); p++)
|
||||||
|
|
||||||
/* if (bAddToStateValues)
|
|
||||||
{
|
{
|
||||||
FFortItemEntryStateValue StateValue;
|
if (CurrentEntry->GetStateValues().at(p).GetStateType() == EFortItemEntryState::ShouldShowItemToast)
|
||||||
StateValue.IntValue = 1;
|
{
|
||||||
StateValue.StateType = EFortItemEntryState::ShouldShowItemToast;
|
CurrentEntry->GetStateValues().at(p).GetIntValue() = bShowItemToast;
|
||||||
|
}
|
||||||
CurrentEntry.StateValues.Add(StateValue);
|
|
||||||
ReplicatedEntry->StateValues.Add(StateValue);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
for (int p = 0; p < ReplicatedEntry->GetStateValues().Num(); p++)
|
||||||
{
|
{
|
||||||
// CurrentEntry.StateValues.FreeBAD();
|
if (ReplicatedEntry->GetStateValues().at(p).GetStateType() == EFortItemEntryState::ShouldShowItemToast)
|
||||||
// ReplicatedEntry->StateValues.FreeBAD();
|
{
|
||||||
} */
|
ReplicatedEntry->GetStateValues().at(p).GetIntValue() = bShowItemToast;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ModifiedItemInstances.push_back(CurrentItemInstance);
|
ModifiedItemInstances.push_back(CurrentItemInstance);
|
||||||
|
|
||||||
@@ -138,6 +137,11 @@ std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddI
|
|||||||
// LOG_INFO(LogDev, "FortItemEntryStruct {}", __int64(FortItemEntryStruct));
|
// LOG_INFO(LogDev, "FortItemEntryStruct {}", __int64(FortItemEntryStruct));
|
||||||
// LOG_INFO(LogDev, "FortItemEntrySize {}", __int64(FortItemEntrySize));
|
// LOG_INFO(LogDev, "FortItemEntrySize {}", __int64(FortItemEntrySize));
|
||||||
|
|
||||||
|
FFortItemEntryStateValue* StateValue = Alloc<FFortItemEntryStateValue>(FFortItemEntryStateValue::GetStructSize());
|
||||||
|
StateValue->GetIntValue() = bShowItemToast;
|
||||||
|
StateValue->GetStateType() = EFortItemEntryState::ShouldShowItemToast;
|
||||||
|
NewItemInstance->GetItemEntry()->GetStateValues().AddPtr(StateValue, FFortItemEntryStateValue::GetStructSize());
|
||||||
|
|
||||||
ItemInstances.Add(NewItemInstance);
|
ItemInstances.Add(NewItemInstance);
|
||||||
GetItemList().GetReplicatedEntries().Add(*NewItemInstance->GetItemEntry(), FortItemEntrySize);
|
GetItemList().GetReplicatedEntries().Add(*NewItemInstance->GetItemEntry(), FortItemEntrySize);
|
||||||
|
|
||||||
@@ -263,6 +267,7 @@ bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int
|
|||||||
{
|
{
|
||||||
if (ItemInstances.at(i)->GetItemEntry()->GetItemGuid() == ItemGuid)
|
if (ItemInstances.at(i)->GetItemEntry()->GetItemGuid() == ItemGuid)
|
||||||
{
|
{
|
||||||
|
ItemInstance->GetItemEntry()->GetStateValues().FreeReal();
|
||||||
ItemInstances.Remove(i);
|
ItemInstances.Remove(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -272,6 +277,7 @@ bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int
|
|||||||
{
|
{
|
||||||
if (ReplicatedEntries.at(i, FortItemEntrySize).GetItemGuid() == ItemGuid)
|
if (ReplicatedEntries.at(i, FortItemEntrySize).GetItemGuid() == ItemGuid)
|
||||||
{
|
{
|
||||||
|
ReplicatedEntries.at(i, FortItemEntrySize).GetStateValues().FreeReal();
|
||||||
ReplicatedEntries.Remove(i, FortItemEntrySize);
|
ReplicatedEntries.Remove(i, FortItemEntrySize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -304,7 +310,7 @@ bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AFortInventory::ModifyCount(UFortItem* ItemInstance, int New, bool bRemove, std::pair<FFortItemEntry*, FFortItemEntry*>* outEntries, bool bUpdate)
|
void AFortInventory::ModifyCount(UFortItem* ItemInstance, int New, bool bRemove, std::pair<FFortItemEntry*, FFortItemEntry*>* outEntries, bool bUpdate, bool bShowItemToast)
|
||||||
{
|
{
|
||||||
auto ReplicatedEntry = FindReplicatedEntry(ItemInstance->GetItemEntry()->GetItemGuid());
|
auto ReplicatedEntry = FindReplicatedEntry(ItemInstance->GetItemEntry()->GetItemGuid());
|
||||||
|
|
||||||
@@ -315,6 +321,22 @@ void AFortInventory::ModifyCount(UFortItem* ItemInstance, int New, bool bRemove,
|
|||||||
{
|
{
|
||||||
ItemInstance->GetItemEntry()->GetCount() += New;
|
ItemInstance->GetItemEntry()->GetCount() += New;
|
||||||
ReplicatedEntry->GetCount() += New;
|
ReplicatedEntry->GetCount() += New;
|
||||||
|
|
||||||
|
for (int p = 0; p < ItemInstance->GetItemEntry()->GetStateValues().Num(); p++)
|
||||||
|
{
|
||||||
|
if (ItemInstance->GetItemEntry()->GetStateValues().at(p).GetStateType() == EFortItemEntryState::ShouldShowItemToast)
|
||||||
|
{
|
||||||
|
ItemInstance->GetItemEntry()->GetStateValues().at(p).GetIntValue() = bShowItemToast;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int p = 0; p < ReplicatedEntry->GetStateValues().Num(); p++)
|
||||||
|
{
|
||||||
|
if (ReplicatedEntry->GetStateValues().at(p).GetStateType() == EFortItemEntryState::ShouldShowItemToast)
|
||||||
|
{
|
||||||
|
ReplicatedEntry->GetStateValues().at(p).GetIntValue() = bShowItemToast;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -115,9 +115,9 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AddItem(UFortItemDefinition* ItemDefinition, bool* bShouldUpdate, int Count = 1, int LoadedAmmo = -1, bool bShouldAddToStateValues = false);
|
std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AddItem(UFortItemDefinition* ItemDefinition, bool* bShouldUpdate, int Count = 1, int LoadedAmmo = -1, bool bShowItemToast = false);
|
||||||
bool RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int Count, bool bForceRemoval = false);
|
bool RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int Count, bool bForceRemoval = false);
|
||||||
void ModifyCount(UFortItem* ItemInstance, int New, bool bRemove = false, std::pair<FFortItemEntry*, FFortItemEntry*>* outEntries = nullptr, bool bUpdate = true);
|
void ModifyCount(UFortItem* ItemInstance, int New, bool bRemove = false, std::pair<FFortItemEntry*, FFortItemEntry*>* outEntries = nullptr, bool bUpdate = true, bool bShowItemToast = false);
|
||||||
|
|
||||||
UFortItem* GetPickaxeInstance();
|
UFortItem* GetPickaxeInstance();
|
||||||
UFortItem* FindItemInstance(UFortItemDefinition* ItemDefinition);
|
UFortItem* FindItemInstance(UFortItemDefinition* ItemDefinition);
|
||||||
|
|||||||
@@ -5,6 +5,58 @@
|
|||||||
|
|
||||||
#include "reboot.h"
|
#include "reboot.h"
|
||||||
|
|
||||||
|
enum class EFortItemEntryState : uint8_t // idk if this changes
|
||||||
|
{
|
||||||
|
NoneState = 0,
|
||||||
|
NewItemCount = 1,
|
||||||
|
ShouldShowItemToast = 2,
|
||||||
|
DurabilityInitialized = 3,
|
||||||
|
DoNotShowSpawnParticles = 4,
|
||||||
|
FromRecoveredBackpack = 5,
|
||||||
|
FromGift = 6,
|
||||||
|
PendingUpgradeCriteriaProgress = 7,
|
||||||
|
OwnerBuildingHandle = 8,
|
||||||
|
FromDroppedPickup = 9,
|
||||||
|
JustCrafted = 10,
|
||||||
|
CraftAndSlotTarget = 11,
|
||||||
|
GenericAttributeValueSet = 12,
|
||||||
|
PickupInstigatorHandle = 13,
|
||||||
|
CreativeUserPrefabHasContent = 14,
|
||||||
|
EFortItemEntryState_MAX = 15
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFortItemEntryStateValue
|
||||||
|
{
|
||||||
|
static UStruct* GetStruct()
|
||||||
|
{
|
||||||
|
static auto Struct = FindObject<UStruct>("/Script/FortniteGame.FortItemEntryStateValue");
|
||||||
|
return Struct;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GetStructSize()
|
||||||
|
{
|
||||||
|
return GetStruct()->GetPropertiesSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
int& GetIntValue()
|
||||||
|
{
|
||||||
|
static auto IntValueOffset = FindOffsetStruct("/Script/FortniteGame.FortItemEntryStateValue", "IntValue");
|
||||||
|
return *(int*)(__int64(this) + IntValueOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
EFortItemEntryState& GetStateType()
|
||||||
|
{
|
||||||
|
static auto StateTypeOffset = FindOffsetStruct("/Script/FortniteGame.FortItemEntryStateValue", "StateType");
|
||||||
|
return *(EFortItemEntryState*)(__int64(this) + StateTypeOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
FName& GetNameValue()
|
||||||
|
{
|
||||||
|
static auto NameValueOffset = FindOffsetStruct("/Script/FortniteGame.FortItemEntryStateValue", "NameValue");
|
||||||
|
return *(FName*)(__int64(this) + NameValueOffset);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
struct FFortItemEntry : FFastArraySerializerItem
|
struct FFortItemEntry : FFastArraySerializerItem
|
||||||
{
|
{
|
||||||
FGuid& GetItemGuid()
|
FGuid& GetItemGuid()
|
||||||
@@ -25,6 +77,12 @@ struct FFortItemEntry : FFastArraySerializerItem
|
|||||||
return *(int*)(__int64(this) + CountOffset);
|
return *(int*)(__int64(this) + CountOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TArray<FFortItemEntryStateValue>& GetStateValues()
|
||||||
|
{
|
||||||
|
static auto StateValuesOffset = FindOffsetStruct("/Script/FortniteGame.FortItemEntry", "StateValues");
|
||||||
|
return *(TArray<FFortItemEntryStateValue>*)(__int64(this) + StateValuesOffset);
|
||||||
|
}
|
||||||
|
|
||||||
int& GetLoadedAmmo()
|
int& GetLoadedAmmo()
|
||||||
{
|
{
|
||||||
static auto LoadedAmmoOffset = FindOffsetStruct("/Script/FortniteGame.FortItemEntry", "LoadedAmmo");
|
static auto LoadedAmmoOffset = FindOffsetStruct("/Script/FortniteGame.FortItemEntry", "LoadedAmmo");
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup)
|
|||||||
cpyCount -= AmountToStack;
|
cpyCount -= AmountToStack;
|
||||||
|
|
||||||
std::pair<FFortItemEntry*, FFortItemEntry*> Pairs;
|
std::pair<FFortItemEntry*, FFortItemEntry*> Pairs;
|
||||||
WorldInventory->ModifyCount(ItemInstance, AmountToStack, false, &Pairs, false);
|
WorldInventory->ModifyCount(ItemInstance, AmountToStack, false, &Pairs, false, true);
|
||||||
PairsToMarkDirty.push_back(Pairs);
|
PairsToMarkDirty.push_back(Pairs);
|
||||||
|
|
||||||
bEverStacked = true;
|
bEverStacked = true;
|
||||||
|
|||||||
@@ -637,7 +637,12 @@ AActor* AFortPlayerController::SpawnToyInstanceHook(UObject* Context, FFrame* St
|
|||||||
auto NewToy = GetWorld()->SpawnActor<AActor>(ToyClass, SpawnPosition, SpawnParameters);
|
auto NewToy = GetWorld()->SpawnActor<AActor>(ToyClass, SpawnPosition, SpawnParameters);
|
||||||
|
|
||||||
static auto ActiveToyInstancesOffset = PlayerController->GetOffset("ActiveToyInstances");
|
static auto ActiveToyInstancesOffset = PlayerController->GetOffset("ActiveToyInstances");
|
||||||
|
auto& ActiveToyInstances = PlayerController->Get<TArray<AActor*>>(ActiveToyInstancesOffset);
|
||||||
|
|
||||||
|
static auto ToySummonCountsOffset = PlayerController->GetOffset("ToySummonCounts");
|
||||||
|
auto& ToySummonCounts = PlayerController->Get<TMap<UClass*, int>>(ToySummonCountsOffset);
|
||||||
|
|
||||||
|
// ActiveToyInstances.Add(NewToy);
|
||||||
|
|
||||||
*Ret = NewToy;
|
*Ret = NewToy;
|
||||||
return *Ret;
|
return *Ret;
|
||||||
|
|||||||
@@ -421,6 +421,7 @@ std::vector<uint64> Addresses::GetFunctionsToNull()
|
|||||||
if (Engine_Version == 421)
|
if (Engine_Version == 421)
|
||||||
{
|
{
|
||||||
toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 48 89 70 10 57 48 81 EC ? ? ? ? 48 8B BA ? ? ? ? 48 8B DA 0F 29").Get()); // Pawn Overlap
|
toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 48 89 70 10 57 48 81 EC ? ? ? ? 48 8B BA ? ? ? ? 48 8B DA 0F 29").Get()); // Pawn Overlap
|
||||||
|
toNull.push_back(Memcury::Scanner::FindStringRef(L"Widget Class %s - Running Initialize On Archetype, %s.").ScanFor({ 0x40, 0x55 }, false).Get()); // Widget class
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Engine_Version == 425)
|
if (Engine_Version == 425)
|
||||||
|
|||||||
@@ -527,7 +527,7 @@ DWORD WINAPI Main(LPVOID)
|
|||||||
|
|
||||||
// if (false)
|
// if (false)
|
||||||
{
|
{
|
||||||
if (Fortnite_Version >= 8.3) // I can't remember, so ServerAddMapMarker existed on like 8.0 or 8.1 or 8.2 but it didn't have the same params.
|
if (Fortnite_Version >= 8.3 && Engine_Version < 424) // I can't remember, so ServerAddMapMarker existed on like 8.0 or 8.1 or 8.2 but it didn't have the same params.
|
||||||
{
|
{
|
||||||
Hooking::MinHook::Hook(AthenaMarkerComponentDefault, FindObject<UFunction>(L"/Script/FortniteGame.AthenaMarkerComponent.ServerAddMapMarker"),
|
Hooking::MinHook::Hook(AthenaMarkerComponentDefault, FindObject<UFunction>(L"/Script/FortniteGame.AthenaMarkerComponent.ServerAddMapMarker"),
|
||||||
UAthenaMarkerComponent::ServerAddMapMarkerHook, nullptr, false);
|
UAthenaMarkerComponent::ServerAddMapMarkerHook, nullptr, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user