mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-13 19:22:22 +01:00
<feat: New project structure>
<feat: New release>
This commit is contained in:
56
dependencies/reboot/Project Reboot 3.0/FortInventoryInterface.cpp
vendored
Normal file
56
dependencies/reboot/Project Reboot 3.0/FortInventoryInterface.cpp
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
#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();
|
||||
int SuperAdditionalOffset = Engine_Version >= 427 ? 16 : 8;
|
||||
auto ControllerObject = (UObject*)(__int64(a1) - (FortPlayerControllerSuperSize + SuperAdditionalOffset));
|
||||
|
||||
// LOG_INFO(LogDev, "bForceRemoval: {}", (bool)bForceRemoval);
|
||||
// LOG_INFO(LogDev, "FortPlayerControllerSuperSize: {}", FortPlayerControllerSuperSize);
|
||||
// LOG_INFO(LogDev, "ControllerObject: {}", ControllerObject->GetFullName());
|
||||
|
||||
// LOG_INFO(LogDev, __FUNCTION__);
|
||||
|
||||
if (!ControllerObject)
|
||||
return false;
|
||||
|
||||
auto PlayerController = Cast<AFortPlayerControllerAthena>(ControllerObject);
|
||||
|
||||
if (!PlayerController)
|
||||
return false;
|
||||
|
||||
auto WorldInventory = PlayerController->GetWorldInventory();
|
||||
|
||||
if (!WorldInventory)
|
||||
return false;
|
||||
|
||||
if (!Globals::bInfiniteAmmo)
|
||||
{
|
||||
bool bShouldUpdate = false;
|
||||
WorldInventory->RemoveItem(a2, &bShouldUpdate, Count, bForceRemoval);
|
||||
|
||||
if (bShouldUpdate)
|
||||
WorldInventory->Update();
|
||||
}
|
||||
|
||||
if (Engine_Version < 424) // doesnt work on c2+ idk why
|
||||
{
|
||||
auto Pawn = PlayerController->GetMyFortPawn();
|
||||
|
||||
if (Pawn)
|
||||
{
|
||||
auto CurrentWeapon = Pawn->GetCurrentWeapon();
|
||||
|
||||
if (CurrentWeapon)
|
||||
WorldInventory->CorrectLoadedAmmo(CurrentWeapon->GetItemEntryGuid(), CurrentWeapon->GetAmmoCount());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user