mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 02:42:22 +01:00
fix autopickup
This commit is contained in:
@@ -12,8 +12,8 @@ struct FAthenaMatchTeamStats
|
|||||||
|
|
||||||
static auto GetStructSize() { return GetStruct()->GetPropertiesSize(); }
|
static auto GetStructSize() { return GetStruct()->GetPropertiesSize(); }
|
||||||
|
|
||||||
int Place; // 0x0000(0x0004) (Edit, BlueprintVisible, BlueprintReadOnly, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
int Place;
|
||||||
int TotalPlayers; // 0x0004(0x0004) (Edit, BlueprintVisible, BlueprintReadOnly, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
int TotalPlayers;
|
||||||
|
|
||||||
int& GetPlace()
|
int& GetPlace()
|
||||||
{
|
{
|
||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
|
|
||||||
static UClass* StaticClass()
|
static UClass* StaticClass()
|
||||||
{
|
{
|
||||||
static auto Class = FindObject<UClass>("/Script/FortniteGame.AthenaPlayerMatchReport");
|
static auto Class = FindObject<UClass>(L"/Script/FortniteGame.AthenaPlayerMatchReport");
|
||||||
return Class;
|
return Class;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -240,10 +240,15 @@ public:
|
|||||||
this->ProcessEvent(ClientOnPawnRevivedFn, &EventInstigator);
|
this->ProcessEvent(ClientOnPawnRevivedFn, &EventInstigator);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool& IsMarkedAlive()
|
bool IsMarkedAlive()
|
||||||
{
|
{
|
||||||
static auto bMarkedAliveOffset = GetOffset("bMarkedAlive");
|
static auto bMarkedAliveOffset = GetOffset("bMarkedAlive", false);
|
||||||
return Get<bool>(bMarkedAliveOffset);
|
|
||||||
|
if (bMarkedAliveOffset == -1) // nots ure if this is possible
|
||||||
|
return true;
|
||||||
|
|
||||||
|
static auto bMarkedAliveFieldMask = GetFieldMask(GetProperty("bMarkedAlive"));
|
||||||
|
return ReadBitfieldValue(bMarkedAliveOffset, bMarkedAliveFieldMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void StartGhostModeHook(UObject* Context, FFrame* Stack, void* Ret); // we could native hook this but eh
|
static void StartGhostModeHook(UObject* Context, FFrame* Stack, void* Ret); // we could native hook this but eh
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ void AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook(UObject* Context, FFrame*
|
|||||||
bool bFromSweep;
|
bool bFromSweep;
|
||||||
auto SweepResultPtr = (FHitResult*)std::realloc(0, FHitResult::GetStructSize());
|
auto SweepResultPtr = (FHitResult*)std::realloc(0, FHitResult::GetStructSize());
|
||||||
|
|
||||||
// LOG_INFO(LogDev, "OnCapsuleBeginOverlapHook!");
|
LOG_INFO(LogDev, "OnCapsuleBeginOverlapHook!");
|
||||||
|
|
||||||
Stack->StepCompiledIn(&OverlappedComp);
|
Stack->StepCompiledIn(&OverlappedComp);
|
||||||
Stack->StepCompiledIn(&OtherActor);
|
Stack->StepCompiledIn(&OtherActor);
|
||||||
@@ -28,6 +28,8 @@ void AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook(UObject* Context, FFrame*
|
|||||||
// LOG_INFO(LogDev, "OtherActor: {}", __int64(OtherActor));
|
// LOG_INFO(LogDev, "OtherActor: {}", __int64(OtherActor));
|
||||||
// LOG_INFO(LogDev, "OtherActorName: {}", OtherActor->IsValidLowLevel() ? OtherActor->GetName() : "BadRead")
|
// LOG_INFO(LogDev, "OtherActorName: {}", OtherActor->IsValidLowLevel() ? OtherActor->GetName() : "BadRead")
|
||||||
|
|
||||||
|
if (!Pawn->IsDBNO())
|
||||||
|
{
|
||||||
if (auto Pickup = Cast<AFortPickup>(OtherActor))
|
if (auto Pickup = Cast<AFortPickup>(OtherActor))
|
||||||
{
|
{
|
||||||
static auto PawnWhoDroppedPickupOffset = Pickup->GetOffset("PawnWhoDroppedPickup");
|
static auto PawnWhoDroppedPickupOffset = Pickup->GetOffset("PawnWhoDroppedPickup");
|
||||||
@@ -41,68 +43,13 @@ void AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook(UObject* Context, FFrame*
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto PlayerController = Cast<AFortPlayerControllerAthena>(Pawn->GetController());
|
if (!IsPrimaryQuickbar(ItemDefinition))
|
||||||
|
|
||||||
if (!PlayerController)
|
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto WorldInventory = PlayerController->GetWorldInventory();
|
|
||||||
|
|
||||||
if (!WorldInventory)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& ItemInstances = WorldInventory->GetItemList().GetItemInstances();
|
|
||||||
|
|
||||||
bool ItemDefGoingInPrimary = IsPrimaryQuickbar(ItemDefinition);
|
|
||||||
int PrimarySlotsFilled = 0;
|
|
||||||
bool bCanStack = false;
|
|
||||||
bool bFoundStack = false;
|
|
||||||
|
|
||||||
for (int i = 0; i < ItemInstances.Num(); ++i)
|
|
||||||
{
|
|
||||||
auto ItemInstance = ItemInstances.at(i);
|
|
||||||
|
|
||||||
if (!ItemInstance)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
auto CurrentItemDefinition = ItemInstance->GetItemEntry()->GetItemDefinition();
|
|
||||||
|
|
||||||
if (!CurrentItemDefinition)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (ItemDefGoingInPrimary && IsPrimaryQuickbar(CurrentItemDefinition))
|
|
||||||
PrimarySlotsFilled++;
|
|
||||||
|
|
||||||
bool bIsInventoryFull = (PrimarySlotsFilled /* - 6 */) >= 5;
|
|
||||||
|
|
||||||
if (CurrentItemDefinition == ItemDefinition)
|
|
||||||
{
|
|
||||||
bFoundStack = true;
|
|
||||||
|
|
||||||
if (ItemInstance->GetItemEntry()->GetCount() < ItemDefinition->GetMaxStackSize())
|
|
||||||
{
|
|
||||||
bCanStack = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bIsInventoryFull)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// std::cout << "bCanStack: " << bCanStack << '\n';
|
|
||||||
// std::cout << "bFoundStack: " << bFoundStack << '\n';
|
|
||||||
|
|
||||||
if (!bCanStack ? (!bFoundStack ? true : ItemDefinition->DoesAllowMultipleStacks()) : true)
|
|
||||||
ServerHandlePickupHook(Pawn, Pickup, 0.4f, FVector(), true);
|
ServerHandlePickupHook(Pawn, Pickup, 0.4f, FVector(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// return OnCapsuleBeginOverlapOriginal(Context, Stack, Ret);
|
}
|
||||||
|
|
||||||
|
// return OnCapsuleBeginOverlapOriginal(Context, Stack, Ret); // we love explicit
|
||||||
}
|
}
|
||||||
@@ -868,8 +868,8 @@ DWORD WINAPI Main(LPVOID)
|
|||||||
AFortPawn::NetMulticast_Athena_BatchedDamageCuesHook, (PVOID*)&AFortPawn::NetMulticast_Athena_BatchedDamageCuesOriginal, false, true);
|
AFortPawn::NetMulticast_Athena_BatchedDamageCuesHook, (PVOID*)&AFortPawn::NetMulticast_Athena_BatchedDamageCuesOriginal, false, true);
|
||||||
Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPawn.MovingEmoteStopped"),
|
Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPawn.MovingEmoteStopped"),
|
||||||
AFortPawn::MovingEmoteStoppedHook, (PVOID*)&AFortPawn::MovingEmoteStoppedOriginal, false, true);
|
AFortPawn::MovingEmoteStoppedHook, (PVOID*)&AFortPawn::MovingEmoteStoppedOriginal, false, true);
|
||||||
// Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawnAthena.OnCapsuleBeginOverlap") ? FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawnAthena.OnCapsuleBeginOverlap") : FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawn.OnCapsuleBeginOverlap"),
|
Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawnAthena.OnCapsuleBeginOverlap") ? FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawnAthena.OnCapsuleBeginOverlap") : FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawn.OnCapsuleBeginOverlap"),
|
||||||
// AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook, (PVOID*)&AFortPlayerPawnAthena::OnCapsuleBeginOverlapOriginal, false, true);
|
AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook, (PVOID*)&AFortPlayerPawnAthena::OnCapsuleBeginOverlapOriginal, false, true);
|
||||||
|
|
||||||
Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_RemoveFortItemFromPlayer"),
|
Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_RemoveFortItemFromPlayer"),
|
||||||
UFortKismetLibrary::K2_RemoveFortItemFromPlayerHook, (PVOID*)&UFortKismetLibrary::K2_RemoveFortItemFromPlayerOriginal, false, true);
|
UFortKismetLibrary::K2_RemoveFortItemFromPlayerHook, (PVOID*)&UFortKismetLibrary::K2_RemoveFortItemFromPlayerOriginal, false, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user