mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 10:52:22 +01:00
toys, ammo in bottom right kinda, fix lootin speeds, being inaccurate, playlist looting kindof, or some things just not working.
38 lines
1.2 KiB
C++
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;
|
|
} |