supply drops

fixed supply drops, llamas, and fishing, loot will now combine before spawning
This commit is contained in:
Milxnor
2023-05-21 13:55:20 -04:00
parent 3ba297e72d
commit 63f819ab07
10 changed files with 164 additions and 109 deletions

View File

@@ -40,13 +40,13 @@ FTransform AActor::GetTransform()
void AActor::SetNetDormancy(ENetDormancy Dormancy)
{
static auto SetNetDormancyFn = FindObject<UFunction>("/Script/Engine.Actor.SetNetDormancy");
static auto SetNetDormancyFn = FindObject<UFunction>(L"/Script/Engine.Actor.SetNetDormancy");
this->ProcessEvent(SetNetDormancyFn, &Dormancy);
}
AActor* AActor::GetOwner()
{
static auto GetOwnerFunction = FindObject<UFunction>("/Script/Engine.Actor.GetOwner");
static auto GetOwnerFunction = FindObject<UFunction>(L"/Script/Engine.Actor.GetOwner");
AActor* Owner = nullptr;
this->ProcessEvent(GetOwnerFunction, &Owner);

View File

@@ -194,7 +194,7 @@ FFortLootTierData* PickLootTierData(const std::vector<UDataTable*>& LTDTables, F
return ChosenRowLootTierData;
}
void PickLootDropsFromLootPackage(const std::vector<UDataTable*>& LPTables, const FName& LootPackageName, std::vector<LootDrop>* OutEntries, int LootPackageCategory = -1, int WorldLevel = 0, bool bPrint = false)
void PickLootDropsFromLootPackage(const std::vector<UDataTable*>& LPTables, const FName& LootPackageName, std::vector<LootDrop>* OutEntries, int LootPackageCategory = -1, int WorldLevel = 0, bool bPrint = false, bool bCombineDrops = true)
{
if (!OutEntries)
return;
@@ -305,7 +305,29 @@ void PickLootDropsFromLootPackage(const std::vector<UDataTable*>& LPTables, cons
auto ActualItemLevel = WorldItemDefinition->PickLevel(FinalItemLevel);
OutEntries->push_back(LootDrop(FFortItemEntry::MakeItemEntry(ItemDefinition, CurrentCountForEntry, LoadedAmmo, 0x3F800000, ActualItemLevel)));
bool bHasCombined = false;
if (bCombineDrops)
{
for (auto& CurrentLootDrop : *OutEntries)
{
if (CurrentLootDrop->GetItemDefinition() == ItemDefinition)
{
int NewCount = CurrentLootDrop->GetCount() + CurrentCountForEntry;
if (NewCount <= ItemDefinition->GetMaxStackSize())
{
bHasCombined = true;
CurrentLootDrop->GetCount() = NewCount;
}
}
}
}
if (!bHasCombined)
{
OutEntries->push_back(LootDrop(FFortItemEntry::MakeItemEntry(ItemDefinition, CurrentCountForEntry, LoadedAmmo, MAX_DURABILITY, ActualItemLevel)));
}
if (Engine_Version >= 424)
{
@@ -346,7 +368,7 @@ void PickLootDropsFromLootPackage(const std::vector<UDataTable*>& LPTables, cons
// #define brudda
std::vector<LootDrop> PickLootDrops(FName TierGroupName, int WorldLevel, int ForcedLootTier, bool bPrint, int recursive)
std::vector<LootDrop> PickLootDrops(FName TierGroupName, int WorldLevel, int ForcedLootTier, bool bPrint, int recursive, bool bCombineDrops)
{
std::vector<LootDrop> LootDrops;

View File

@@ -255,4 +255,4 @@ FORCEINLINE static ValueType PickWeightedElement(const std::unordered_map<KeyTyp
return ValueType();
}
std::vector<LootDrop> PickLootDrops(FName TierGroupName, int WorldLevel, int ForcedLootTier = -1, bool bPrint = false, int recursive = 0);
std::vector<LootDrop> PickLootDrops(FName TierGroupName, int WorldLevel, int ForcedLootTier = -1, bool bPrint = false, int recursive = 0, bool bCombineDrops = true);

View File

@@ -703,59 +703,6 @@ void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController*
}
// PlayerController->ServerRestartPlayer();
if (Globals::bLateGame)
{
static int LastNum1 = 124;
if (LastNum1 != AmountOfRestarts)
{
auto SafeZoneIndicator = GameMode->GetSafeZoneIndicator();
if (SafeZoneIndicator)
{
LastNum1 = AmountOfRestarts;
SafeZoneIndicator->SkipShrinkSafeZone();
SafeZoneIndicator->SkipShrinkSafeZone();
}
}
static auto WoodItemData = FindObject<UFortItemDefinition>(L"/Game/Items/ResourcePickups/WoodItemData.WoodItemData");
static auto StoneItemData = FindObject<UFortItemDefinition>(L"/Game/Items/ResourcePickups/StoneItemData.StoneItemData");
static auto MetalItemData = FindObject<UFortItemDefinition>(L"/Game/Items/ResourcePickups/MetalItemData.MetalItemData");
static auto Rifle = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Weapons/WID_Assault_AutoHigh_Athena_SR_Ore_T03.WID_Assault_AutoHigh_Athena_SR_Ore_T03");
static auto Shotgun = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Weapons/WID_Shotgun_Standard_Athena_SR_Ore_T03.WID_Shotgun_Standard_Athena_SR_Ore_T03");
static auto SMG = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Weapons/WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03.WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03");
static auto MiniShields = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Consumables/ShieldSmall/Athena_ShieldSmall.Athena_ShieldSmall");
static auto Shells = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Ammo/AthenaAmmoDataShells.AthenaAmmoDataShells");
static auto Medium = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsMedium.AthenaAmmoDataBulletsMedium");
static auto Light = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsLight.AthenaAmmoDataBulletsLight");
static auto Heavy = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsHeavy.AthenaAmmoDataBulletsHeavy");
auto WorldInventory = PlayerController->GetWorldInventory();
if (!WorldInventory)
return ServerAttemptAircraftJumpOriginal(PC, ClientRotation);
WorldInventory->AddItem(WoodItemData, nullptr, 500);
WorldInventory->AddItem(StoneItemData, nullptr, 500);
WorldInventory->AddItem(MetalItemData, nullptr, 500);
WorldInventory->AddItem(Rifle, nullptr, 1);
WorldInventory->AddItem(Shotgun, nullptr, 1);
WorldInventory->AddItem(SMG, nullptr, 1);
WorldInventory->AddItem(MiniShields, nullptr, 6);
WorldInventory->AddItem(Shells, nullptr, 999);
WorldInventory->AddItem(Medium, nullptr, 999);
WorldInventory->AddItem(Light, nullptr, 999);
WorldInventory->AddItem(Heavy, nullptr, 999);
WorldInventory->Update();
}
// return ServerAttemptAircraftJumpOriginal(PC, ClientRotation);
}

View File

@@ -225,6 +225,43 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
WorldInventory->Update();
}
else
{
if (GameState->GetGamePhase() == EAthenaGamePhase::Aircraft)
{
if (Globals::bLateGame)
{
static auto WoodItemData = FindObject<UFortItemDefinition>(L"/Game/Items/ResourcePickups/WoodItemData.WoodItemData");
static auto StoneItemData = FindObject<UFortItemDefinition>(L"/Game/Items/ResourcePickups/StoneItemData.StoneItemData");
static auto MetalItemData = FindObject<UFortItemDefinition>(L"/Game/Items/ResourcePickups/MetalItemData.MetalItemData");
static auto Rifle = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Weapons/WID_Assault_AutoHigh_Athena_SR_Ore_T03.WID_Assault_AutoHigh_Athena_SR_Ore_T03");
static auto Shotgun = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Weapons/WID_Shotgun_Standard_Athena_SR_Ore_T03.WID_Shotgun_Standard_Athena_SR_Ore_T03");
static auto SMG = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Weapons/WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03.WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03");
static auto MiniShields = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Consumables/ShieldSmall/Athena_ShieldSmall.Athena_ShieldSmall");
static auto Shells = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Ammo/AthenaAmmoDataShells.AthenaAmmoDataShells");
static auto Medium = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsMedium.AthenaAmmoDataBulletsMedium");
static auto Light = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsLight.AthenaAmmoDataBulletsLight");
static auto Heavy = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsHeavy.AthenaAmmoDataBulletsHeavy");
WorldInventory->AddItem(WoodItemData, nullptr, 500);
WorldInventory->AddItem(StoneItemData, nullptr, 500);
WorldInventory->AddItem(MetalItemData, nullptr, 500);
WorldInventory->AddItem(Rifle, nullptr, 1);
WorldInventory->AddItem(Shotgun, nullptr, 1);
WorldInventory->AddItem(SMG, nullptr, 1);
WorldInventory->AddItem(MiniShields, nullptr, 6);
WorldInventory->AddItem(Shells, nullptr, 999);
WorldInventory->AddItem(Medium, nullptr, 999);
WorldInventory->AddItem(Light, nullptr, 999);
WorldInventory->AddItem(Heavy, nullptr, 999);
WorldInventory->Update();
}
}
}
}
else
{

View File

@@ -819,7 +819,6 @@
<ClInclude Include="FortAthenaVehicleSpawner.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Athena\Vehicle</Filter>
</ClInclude>
<ClInclude Include="discord.h" />
<ClInclude Include="FortAthenaSupplyDrop.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Building</Filter>
</ClInclude>
@@ -934,6 +933,9 @@
<ClInclude Include="BuildingItemWeaponUpgradeActor.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Building\GameplayActors</Filter>
</ClInclude>
<ClInclude Include="discord.h">
<Filter>Reboot\Public</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Engine">

View File

@@ -73,12 +73,9 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
static auto ClientConnectionsOffset = WorldNetDriver->GetOffset("ClientConnections");
auto& ClientConnections = WorldNetDriver->Get<TArray<UObject*>>(ClientConnectionsOffset);
/* if (firstBackslash == lastBackslash)
if (firstBackslash != std::string::npos && lastBackslash != std::string::npos)
{
SendMessageToConsole(PlayerController, L"Warning: You have a backslash but no ending backslash, was this by mistake? Executing on you.");
} */
if (firstBackslash != lastBackslash && firstBackslash != std::string::npos && lastBackslash != std::string::npos) // we want to specify a player
if (firstBackslash != lastBackslash)
{
std::string player = OldMsg;
@@ -110,6 +107,11 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
PlayerName.Free();
}
}
else
{
// SendMessageToConsole(PlayerController, L"Warning: You have a backslash but no ending backslash, was this by mistake? Executing on you.");
}
}
if (!ReceivingController || !ReceivingPlayerState)
{
@@ -624,7 +626,7 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
Count = Max;
}
static auto BGAClass = FindObject<UClass>("/Script/Engine.BlueprintGeneratedClass");
static auto BGAClass = FindObject<UClass>(L"/Script/Engine.BlueprintGeneratedClass");
auto ClassObj = LoadObject<UClass>(ClassName, BGAClass);
if (ClassObj)

View File

@@ -19,8 +19,6 @@ static void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int Override
LOG_INFO(LogDev, "SetZoneToIndexHook!");
bool bIsFirstZone = false;
auto GameState = Cast<AFortGameStateAthena>(GameModeAthena->GetGameState());
LOG_INFO(LogDev, "GamePhaseStep: {}", (int)GameState->GetGamePhaseStep());
@@ -30,31 +28,26 @@ static void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int Override
static auto GameMode_SafeZonePhaseOffset = GameModeAthena->GetOffset("SafeZonePhase");
static auto GameState_SafeZonePhaseOffset = GameState->GetOffset("SafeZonePhase");
int NewSafeZonePhase = GameModeAthena->Get<int>(GameMode_SafeZonePhaseOffset);
static int ahaaSafeZonePhase = 4;
int NewSafeZonePhase = ahaaSafeZonePhase; // GameModeAthena->Get<int>(GameMode_SafeZonePhaseOffset);
const int OriginalOldSafeZonePhase = GameModeAthena->Get<int>(GameMode_SafeZonePhaseOffset);
if (NewSafeZonePhase < 4)
{
NewSafeZonePhase = 4;
bIsFirstZone = true;
}
LOG_INFO(LogDev, "Setting zone to: {}", NewSafeZonePhase);
LOG_INFO(LogDev, "Setting zone to: {} ({})", NewSafeZonePhase, OriginalOldSafeZonePhase);
GameModeAthena->Get<int>(GameMode_SafeZonePhaseOffset) = NewSafeZonePhase;
GameState->Get<int>(GameState_SafeZonePhaseOffset) = NewSafeZonePhase;
ahaaSafeZonePhase++;
}
if (Fortnite_Version < 13)
{
SetZoneToIndexOriginal(GameModeAthena, OverridePhaseMaybeIDFK);
if (Globals::bLateGame && bIsFirstZone)
{
// UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"skipshrinksafezone", nullptr);
// UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr);
// UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"skipshrinksafezone", nullptr);
}
return;
}

View File

@@ -818,7 +818,7 @@ DWORD WINAPI Main(LPVOID)
Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_SpawnPickupInWorldWithClass"),
UFortKismetLibrary::K2_SpawnPickupInWorldWithClassHook, (PVOID*)&UFortKismetLibrary::K2_SpawnPickupInWorldWithClassOriginal, false, true);
if (Addresses::FreeArrayOfEntries || Addresses::FreeEntry)
// if (Addresses::FreeArrayOfEntries || Addresses::FreeEntry)
{
Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.PickLootDrops"),
UFortKismetLibrary::PickLootDropsHook, (PVOID*)&UFortKismetLibrary::PickLootDropsOriginal, false, true);

View File

@@ -46,7 +46,7 @@
#define GAMEMODE_TAB 3
#define THANOS_TAB 4
#define EVENT_TAB 5
#define LATEGAME_TAB 6
#define ZONE_TAB 6
#define DUMP_TAB 7
#define UNBAN_TAB 8
#define DEVELOPER_TAB 9
@@ -347,9 +347,9 @@ static inline void MainTabs()
}
}
if (false && Globals::bLateGame && ImGui::BeginTabItem(("Lategame")))
if (ImGui::BeginTabItem(("Zone")))
{
Tab = LATEGAME_TAB;
Tab = ZONE_TAB;
PlayerTab = -1;
bInformationTab = false;
ImGui::EndTabItem();
@@ -576,13 +576,13 @@ static inline void MainUI()
if (!bStartedBus)
{
if (Globals::bLateGame.load())
if (Globals::bLateGame.load() || Fortnite_Version >= 11)
{
if (ImGui::Button("Start Bus"))
{
bStartedBus = true;
auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode();
auto GameMode = (AFortGameModeAthena*)GetWorld()->GetGameMode();
auto GameState = GameMode->GetGameState();
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startaircraft", nullptr);
@@ -688,6 +688,24 @@ static inline void MainUI()
static auto bAircraftIsLockedOffset = GameState->GetOffset("bAircraftIsLocked");
static auto bAircraftIsLockedFieldMask = GetFieldMask(GameState->GetProperty("bAircraftIsLocked"));
GameState->SetBitfieldValue(bAircraftIsLockedOffset, bAircraftIsLockedFieldMask, false);
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startaircraft", nullptr);
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"skipaircraft", nullptr);
auto SafeZoneIndicator = GameMode->GetSafeZoneIndicator();
if (SafeZoneIndicator)
{
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr);
SafeZoneIndicator->SkipShrinkSafeZone();
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr);
SafeZoneIndicator->SkipShrinkSafeZone();
// Sleep(1000);
// SafeZoneIndicator->SkipShrinkSafeZone();
}
LOG_INFO(LogDev, "Finished!");
}
}
else
@@ -785,6 +803,40 @@ static inline void MainUI()
}
}
else if (Tab == ZONE_TAB)
{
if (ImGui::Button("Start Safe Zone"))
{
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startsafezone", nullptr);
}
if (ImGui::Button("Pause Safe Zone"))
{
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"pausesafezone", nullptr);
}
if (ImGui::Button("Skip Zone"))
{
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"skipsafezone", nullptr);
}
if (ImGui::Button("Start Shrink Safe Zone"))
{
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr);
}
if (ImGui::Button("Skip Shrink Safe Zone"))
{
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
auto SafeZoneIndicator = GameMode->GetSafeZoneIndicator();
if (SafeZoneIndicator)
{
SafeZoneIndicator->SkipShrinkSafeZone();
}
}
}
else if (Tab == DUMP_TAB)
{
ImGui::Text("These will all be in your Win64 folder!");