fixed teams on older versions

This commit is contained in:
Milxnor
2023-06-20 09:39:33 -04:00
parent 779c932b3f
commit 1d12b8929f
3 changed files with 8 additions and 11 deletions

View File

@@ -153,30 +153,27 @@ float GetAmountOfLootPackagesToDrop(FFortLootTierData* LootTierData, int Origina
FFortLootTierData* PickLootTierData(const std::vector<UDataTable*>& LTDTables, FName LootTierGroup, int ForcedLootTier = -1, FName* OutRowName = nullptr) // Fortnite returns the row name and then finds the tier data again, but I really don't see the point of this. FFortLootTierData* PickLootTierData(const std::vector<UDataTable*>& LTDTables, FName LootTierGroup, int ForcedLootTier = -1, FName* OutRowName = nullptr) // Fortnite returns the row name and then finds the tier data again, but I really don't see the point of this.
{ {
// This like isn't right, at all.
float LootTier = ForcedLootTier; float LootTier = ForcedLootTier;
float IdkForcedWeightorsomething = 1;
if (LootTier == -1) if (LootTier == -1)
{ {
// LootTier = ?? // IdkForcedWeightorsomething = weightofAlltherowsithink // we don't ened to do this since the pickweightedeleent already does that
} }
else else
{ {
// buncha code im too lazy to reverse // ITS SO MUCH TO REVERSE AAAAA
} }
// if (fabs(LootTier) <= 0.0000000099999999) // if (fabs(LootTier) <= 0.0000000099999999)
// return 0; // return 0;
int Multiplier = LootTier == -1 ? 1 : LootTier; // Idk i think we need to fill out the code above for this to work properly maybe
LOOTING_MAP_TYPE<FName, FFortLootTierData*> TierGroupLTDs; LOOTING_MAP_TYPE<FName, FFortLootTierData*> TierGroupLTDs;
CollectDataTablesRows<FFortLootTierData>(LTDTables, &TierGroupLTDs, [&](FName RowName, FFortLootTierData* TierData) -> bool { CollectDataTablesRows<FFortLootTierData>(LTDTables, &TierGroupLTDs, [&](FName RowName, FFortLootTierData* TierData) -> bool {
if (LootTierGroup == TierData->GetTierGroup()) if (LootTierGroup == TierData->GetTierGroup())
{ {
if ((LootTier == -1 ? true : LootTier == TierData->GetLootTier())) if ((LootTier == -1 ? true : LootTier == TierData->GetLootTier())) // idek if this is proper
{ {
return true; return true;
} }
@@ -189,7 +186,7 @@ FFortLootTierData* PickLootTierData(const std::vector<UDataTable*>& LTDTables, F
FFortLootTierData* ChosenRowLootTierData = PickWeightedElement<FName, FFortLootTierData*>(TierGroupLTDs, FFortLootTierData* ChosenRowLootTierData = PickWeightedElement<FName, FFortLootTierData*>(TierGroupLTDs,
[](FFortLootTierData* LootTierData) -> float { return LootTierData->GetWeight(); }, RandomFloatForLoot, -1, [](FFortLootTierData* LootTierData) -> float { return LootTierData->GetWeight(); }, RandomFloatForLoot, -1,
true, Multiplier, OutRowName); true, 1, OutRowName, false, false, IdkForcedWeightorsomething);
return ChosenRowLootTierData; return ChosenRowLootTierData;
} }

View File

@@ -144,7 +144,7 @@ template <typename KeyType, typename ValueType>
FORCEINLINE static ValueType PickWeightedElement(const std::map<KeyType, ValueType>& Elements, FORCEINLINE static ValueType PickWeightedElement(const std::map<KeyType, ValueType>& Elements,
std::function<float(ValueType)> GetWeightFn, std::function<float(ValueType)> GetWeightFn,
std::function<float(float)> RandomFloatGenerator = RandomFloatForLoot, std::function<float(float)> RandomFloatGenerator = RandomFloatForLoot,
float TotalWeightParam = -1, bool bCheckIfWeightIsZero = false, int RandMultiplier = 1, KeyType* OutName = nullptr, bool bPrint = false, bool bKeepGoingUntilWeGetValue = false) float TotalWeightParam = -1, bool bCheckIfWeightIsZero = false, int RandMultiplier = 1, KeyType* OutName = nullptr, bool bPrint = false, bool bKeepGoingUntilWeGetValue = false, float AHHH = 1)
{ {
float TotalWeight = TotalWeightParam; float TotalWeight = TotalWeightParam;
@@ -165,7 +165,7 @@ FORCEINLINE static ValueType PickWeightedElement(const std::map<KeyType, ValueTy
}); });
} }
float RandomNumber = RandMultiplier * RandomFloatGenerator(TotalWeight); float RandomNumber = RandMultiplier * RandomFloatGenerator(AHHH == -1 ? TotalWeight : AHHH);
if (bPrint) if (bPrint)
{ {

View File

@@ -367,7 +367,7 @@ DWORD WINAPI Main(LPVOID)
Addresses::SetupVersion(); Addresses::SetupVersion();
NumToSubtractFromSquadId = Engine_Version >= 424 ? 2 : 3; // TODO: check this NumToSubtractFromSquadId = Engine_Version >= 424 ? 2 : Engine_Version >= 423 ? 3 : 0; // TODO: check this
NumElementsPerChunk = std::floor(Fortnite_Version) >= 5 && Fortnite_Version <= 6 ? 0x10400 : 0x10000; // Idk what version tbh NumElementsPerChunk = std::floor(Fortnite_Version) >= 5 && Fortnite_Version <= 6 ? 0x10400 : 0x10000; // Idk what version tbh
Offsets::FindAll(); // We have to do this before because FindCantBuild uses FortAIController.CreateBuildingActor Offsets::FindAll(); // We have to do this before because FindCantBuild uses FortAIController.CreateBuildingActor