Files
Project-Reboot-3.0/Project Reboot 3.0/FortWeapon.cpp
Milxnor 701d3ad0d0 a bit of stuff
toys, ammo in bottom right kinda, fix lootin speeds, being inaccurate, playlist looting kindof, or some things just not working.
2023-04-01 15:54:47 -04:00

38 lines
1.2 KiB
C++

#include "FortWeapon.h"
#include "FortPlayerPawn.h"
#include "reboot.h"
#include "FortPlayerController.h"
void AFortWeapon::ServerReleaseWeaponAbilityHook(UObject* Context, FFrame* Stack, void* Ret)
{
// I don't know where to put this..
auto Weapon = (AFortWeapon*)Context;
auto Pawn = Cast<AFortPlayerPawn>(Weapon->GetOwner());
// LOG_INFO(LogDev, "Owner: {}", Weapon->GetOwner() ? Weapon->GetOwner()->GetFullName() : "InvalidObject");
if (!Pawn)
return ServerReleaseWeaponAbilityOriginal(Context, Stack, Ret);
auto Controller = Cast<AFortPlayerController>(Pawn->GetController());
auto CurrentWeapon = Weapon; // Pawn->GetCurrentWeapon();
auto WorldInventory = Controller ? Controller->GetWorldInventory() : nullptr;
if (!WorldInventory || !CurrentWeapon)
return ServerReleaseWeaponAbilityOriginal(Context, Stack, Ret);
static auto AmmoCountOffset = CurrentWeapon->GetOffset("AmmoCount");
auto AmmoCount = CurrentWeapon->Get<int>(AmmoCountOffset);
WorldInventory->CorrectLoadedAmmo(CurrentWeapon->GetItemEntryGuid(), AmmoCount);
return ServerReleaseWeaponAbilityOriginal(Context, Stack, Ret);
}
UClass* AFortWeapon::StaticClass()
{
static auto Class = FindObject<UClass>(L"/Script/FortniteGame.FortWeapon");
return Class;
}