add mat depletion, ammo cost, fixed dying crashing on s16+, fix aircraft starting on some versions, fix zone on s17
This commit is contained in:
Milxnor
2023-03-31 20:24:21 -04:00
parent d53626a850
commit fbfb6bbe54
16 changed files with 179 additions and 30 deletions

View File

@@ -1,14 +1,37 @@
#include "FortInventoryInterface.h"
#include "reboot.h"
#include "FortPlayerControllerAthena.h"
char UFortInventoryInterface::RemoveInventoryItemHook(__int64 a1, FGuid a2, int Count, char bForceRemoveFromQuickBars, char bForceRemoval)
{
// kms bruh
static auto FortPlayerControllerSuperSize = (*(UClass**)(__int64(FindObject<UClass>("/Script/FortniteGame.FortPlayerController")) + Offsets::SuperStruct))->GetPropertiesSize();
auto Controller = *(UObject**)(__int64(a1) - (FortPlayerControllerSuperSize + 8));
int SuperAdditionalOffset = Engine_Version >= 427 ? 16 : 8;
auto ControllerObject = (UObject*)(__int64(a1) - (FortPlayerControllerSuperSize + SuperAdditionalOffset));
LOG_INFO(LogDev, "FortPlayerControllerSuperSize: {}", FortPlayerControllerSuperSize);
LOG_INFO(LogDev, "Controller: {}", Controller->GetFullName());
LOG_INFO(LogDev, "ControllerObject: {}", ControllerObject->GetFullName());
if (!ControllerObject)
return false;
auto PlayerController = Cast<AFortPlayerControllerAthena>(ControllerObject);
if (!PlayerController)
return false;
auto WorldInventory = PlayerController->GetWorldInventory();
if (!WorldInventory)
return false;
bool bShouldUpdate = false;
WorldInventory->RemoveItem(a2, &bShouldUpdate, Count);
if (bShouldUpdate)
WorldInventory->Update();
return true;
}