a bit of stuff

toys, ammo in bottom right kinda, fix lootin speeds, being inaccurate, playlist looting kindof, or some things just not working.
This commit is contained in:
Milxnor
2023-04-01 15:54:47 -04:00
parent a03c1cef2b
commit 701d3ad0d0
23 changed files with 437 additions and 149 deletions

View File

@@ -1,6 +1,35 @@
#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()
{