mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 10:52:22 +01:00
a good update
Added a very useful debugging tool, made looting even more proper
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "UObjectArray.h"
|
||||
#include "GameplayTagContainer.h"
|
||||
#include "FortGameModeAthena.h"
|
||||
#include "FortLootLevel.h"
|
||||
|
||||
struct FFortGameFeatureLootTableData
|
||||
{
|
||||
@@ -51,11 +52,6 @@ void CollectDataTablesRows(std::vector<UDataTable*> DataTables, std::map<FName,
|
||||
}
|
||||
}
|
||||
|
||||
int GetItemLevel(const FDataTableCategoryHandle& LootLevelData, int WorldLevel)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
float GetAmountOfLootPackagesToDrop(FFortLootTierData* LootTierData, int OriginalNumberLootDrops)
|
||||
{
|
||||
if (LootTierData->GetLootPackageCategoryMinArray().Num() != LootTierData->GetLootPackageCategoryWeightArray().Num()
|
||||
@@ -183,7 +179,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, 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)
|
||||
{
|
||||
if (!OutEntries)
|
||||
return;
|
||||
@@ -201,14 +197,16 @@ void PickLootDropsFromLootPackage(const std::vector<UDataTable*>& LPTables, cons
|
||||
return false;
|
||||
}
|
||||
|
||||
/* if (WorldLevel >= 0)
|
||||
// todo add required tag?
|
||||
|
||||
if (WorldLevel >= 0)
|
||||
{
|
||||
if (LootPackage->MaxWorldLevel >= 0 && WorldLevel > LootPackage->MaxWorldLevel)
|
||||
if (LootPackage->GetMaxWorldLevel() >= 0 && WorldLevel > LootPackage->GetMaxWorldLevel())
|
||||
return 0;
|
||||
|
||||
if (LootPackage->MinWorldLevel >= 0 && WorldLevel < LootPackage->MinWorldLevel)
|
||||
if (LootPackage->GetMinWorldLevel() >= 0 && WorldLevel < LootPackage->GetMinWorldLevel())
|
||||
return 0;
|
||||
} */
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
@@ -242,7 +240,7 @@ void PickLootDropsFromLootPackage(const std::vector<UDataTable*>& LPTables, cons
|
||||
|
||||
PickLootDropsFromLootPackage(LPTables,
|
||||
PickedPackage->GetLootPackageCall().Data.Data ? UKismetStringLibrary::Conv_StringToName(PickedPackage->GetLootPackageCall()) : FName(0),
|
||||
OutEntries, LootPackageCategoryToUseForLPCall, bPrint
|
||||
OutEntries, LootPackageCategoryToUseForLPCall, WorldLevel, bPrint
|
||||
);
|
||||
|
||||
v9++;
|
||||
@@ -260,15 +258,15 @@ void PickLootDropsFromLootPackage(const std::vector<UDataTable*>& LPTables, cons
|
||||
return;
|
||||
}
|
||||
|
||||
int ItemLevel = 0;
|
||||
|
||||
auto WeaponItemDefinition = Cast<UFortWeaponItemDefinition>(ItemDefinition);
|
||||
int LoadedAmmo = WeaponItemDefinition ? WeaponItemDefinition->GetClipSize() : 0; // we shouldnt set loaded ammo here techinally
|
||||
|
||||
if (auto WorldItemDefinition = Cast<UFortWorldItemDefinition>(ItemDefinition))
|
||||
{
|
||||
ItemLevel = 0; // GetItemLevel(WorldItemDefinition->LootLevelData, 0);
|
||||
}
|
||||
auto WorldItemDefinition = Cast<UFortWorldItemDefinition>(ItemDefinition);
|
||||
|
||||
if (!WorldItemDefinition) // hahahah not proper!!
|
||||
return;
|
||||
|
||||
int ItemLevel = UFortLootLevel::GetItemLevel(WorldItemDefinition->GetLootLevelData(), WorldLevel);
|
||||
|
||||
int CountMultiplier = 1;
|
||||
int FinalCount = CountMultiplier * PickedPackage->GetCount();
|
||||
@@ -282,15 +280,30 @@ void PickLootDropsFromLootPackage(const std::vector<UDataTable*>& LPTables, cons
|
||||
|
||||
while (FinalCount > 0)
|
||||
{
|
||||
int CurrentCountForEntry = PickedPackage->GetCount(); // Idk calls some itemdefinition vfunc
|
||||
int MaxStackSize = ItemDefinition->GetMaxStackSize();
|
||||
|
||||
OutEntries->push_back(LootDrop(FFortItemEntry::MakeItemEntry(ItemDefinition, CurrentCountForEntry, LoadedAmmo)));
|
||||
int CurrentCountForEntry = MaxStackSize;
|
||||
|
||||
if (FinalCount <= MaxStackSize)
|
||||
CurrentCountForEntry = FinalCount;
|
||||
|
||||
if (CurrentCountForEntry <= 0)
|
||||
CurrentCountForEntry = 0;
|
||||
|
||||
auto ActualItemLevel = WorldItemDefinition->PickLevel(FinalItemLevel);
|
||||
|
||||
OutEntries->push_back(LootDrop(FFortItemEntry::MakeItemEntry(ItemDefinition, CurrentCountForEntry, LoadedAmmo, 0x3F800000, ActualItemLevel)));
|
||||
|
||||
/* if (bPrint)
|
||||
{
|
||||
LOG_INFO(LogDev, "ActualItemLevel: {} FinalItemLevel: {} ItemLevel: {}", ActualItemLevel, FinalItemLevel, ItemLevel);
|
||||
} */
|
||||
|
||||
if (Engine_Version >= 424)
|
||||
{
|
||||
/*
|
||||
|
||||
Alright, so Fortnite literally doesn't reference the first loot package category for chests and floor loot (didnt check rest).
|
||||
Alright, so Fortnite literally doesn't reference the first loot package category for chests and floor loot on chapter two and above (didnt check rest).
|
||||
Usually the first loot package category in our case is ammo, so this is quite weird.
|
||||
I have no clue how Fortnite would actually add the ammo.
|
||||
|
||||
@@ -306,7 +319,7 @@ void PickLootDropsFromLootPackage(const std::vector<UDataTable*>& LPTables, cons
|
||||
|
||||
if (AmmoData)
|
||||
{
|
||||
int AmmoCount = AmmoData->GetDropCount(); // idk about this one
|
||||
int AmmoCount = AmmoData->GetDropCount(); // uhh???
|
||||
|
||||
OutEntries->push_back(LootDrop(FFortItemEntry::MakeItemEntry(AmmoData, AmmoCount)));
|
||||
}
|
||||
@@ -323,7 +336,7 @@ void PickLootDropsFromLootPackage(const std::vector<UDataTable*>& LPTables, cons
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<LootDrop> PickLootDrops(FName TierGroupName, int ForcedLootTier, bool bPrint, int recursive)
|
||||
std::vector<LootDrop> PickLootDrops(FName TierGroupName, int WorldLevel, int ForcedLootTier, bool bPrint, int recursive)
|
||||
{
|
||||
std::vector<LootDrop> LootDrops;
|
||||
|
||||
@@ -659,7 +672,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, int ForcedLootTier, boo
|
||||
|
||||
int LootPackageCategory = i;
|
||||
|
||||
PickLootDropsFromLootPackage(LPTables, ChosenRowLootTierData->GetLootPackage(), &LootDrops, LootPackageCategory, bPrint);
|
||||
PickLootDropsFromLootPackage(LPTables, ChosenRowLootTierData->GetLootPackage(), &LootDrops, LootPackageCategory, WorldLevel, bPrint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user