diff --git a/Core/Generators/BotLootGenerator.cs b/Core/Generators/BotLootGenerator.cs index 470dea35..c644034d 100644 --- a/Core/Generators/BotLootGenerator.cs +++ b/Core/Generators/BotLootGenerator.cs @@ -79,7 +79,11 @@ public class BotLootGenerator /// public ItemSpawnLimitSettings GetItemSpawnLimitsForBot(string botRole) { - throw new NotImplementedException(); + // Init item limits + Dictionary limitsForBotDict = new(); + InitItemLimitArray(botRole, limitsForBotDict); + + return new() { CurrentLimits = limitsForBotDict, GlobalLimits = GetItemSpawnLimitsForBotType(botRole) }; } /// @@ -157,7 +161,7 @@ public class BotLootGenerator botInventory, botRole, botItemLimits, - containersIdFull + containersIdFull: containersIdFull ); // Healing items / Meds @@ -168,9 +172,9 @@ public class BotLootGenerator botInventory, botRole, null, - containersIdFull, 0, - isPmc + isPmc, + containersIdFull ); // Drugs @@ -181,9 +185,9 @@ public class BotLootGenerator botInventory, botRole, null, - containersIdFull, 0, - isPmc + isPmc, + containersIdFull ); // Food @@ -194,9 +198,9 @@ public class BotLootGenerator botInventory, botRole, null, - containersIdFull, 0, - isPmc + isPmc, + containersIdFull ); // Drink @@ -207,9 +211,9 @@ public class BotLootGenerator botInventory, botRole, null, - containersIdFull, 0, - isPmc + isPmc, + containersIdFull ); // Currency @@ -220,9 +224,9 @@ public class BotLootGenerator botInventory, botRole, null, - containersIdFull, 0, - isPmc + isPmc, + containersIdFull ); // Stims @@ -233,9 +237,9 @@ public class BotLootGenerator botInventory, botRole, botItemLimits, - containersIdFull, 0, - isPmc + isPmc, + containersIdFull ); // Grenades @@ -246,9 +250,9 @@ public class BotLootGenerator botInventory, botRole, null, - containersIdFull, 0, - isPmc + isPmc, + containersIdFull ); var itemPriceLimits = GetSingleItemLootPriceLimits(botLevel, isPmc); @@ -286,9 +290,9 @@ public class BotLootGenerator botInventory, botRole, botItemLimits, - containersIdFull, - backpackLootRoubleTotal, - isPmc + backpackLootRoubleTotal ?? 0, + isPmc, + containersIdFull ); } @@ -309,9 +313,9 @@ public class BotLootGenerator botInventory, botRole, botItemLimits, - containersIdFull, _pmcConfig.MaxVestLootTotalRub, - isPmc + isPmc, + containersIdFull ); } @@ -329,9 +333,9 @@ public class BotLootGenerator botInventory, botRole, botItemLimits, - containersIdFull, _pmcConfig.MaxPocketLootTotalRub, - isPmc + isPmc, + containersIdFull ); // Secure @@ -346,9 +350,9 @@ public class BotLootGenerator botInventory, botRole, null, - containersIdFull, -1, - isPmc + isPmc, + containersIdFull ); } } @@ -375,9 +379,17 @@ public class BotLootGenerator /// Bots level /// Is the bot a PMC /// int - public int GetBackpackRoubleTotalByLevel(int botLevel, bool isPmc) + public double? GetBackpackRoubleTotalByLevel(int botLevel, bool isPmc) { - throw new NotImplementedException(); + if (isPmc) + { + var matchingValue = _pmcConfig.MaxBackpackLootTotalRub.FirstOrDefault( + (minMaxValue) => botLevel >= minMaxValue.Min && botLevel <= minMaxValue.Max + ); + return matchingValue?.Value; + } + + return 0; } /// @@ -388,7 +400,19 @@ public class BotLootGenerator /// public List GetAvailableContainersBotCanStoreItemsIn(BotBaseInventory botInventory) { - throw new NotImplementedException(); + List result = [EquipmentSlots.Pockets]; + + if (botInventory.Items.Any((item) => item.SlotId == EquipmentSlots.TacticalVest.ToString())) + { + result.Add(EquipmentSlots.TacticalVest); + } + + if (botInventory.Items.Any((item) => item.SlotId == EquipmentSlots.Backpack.ToString())) + { + result.Add(EquipmentSlots.Backpack); + } + + return result; } /// @@ -398,7 +422,29 @@ public class BotLootGenerator /// Role of bot (pmcBEAR/pmcUSEC) public void AddForcedMedicalItemsToPmcSecure(BotBaseInventory botInventory, string botRole) { - throw new NotImplementedException(); + // surv12 + AddLootFromPool( + new() { { "5d02797c86f774203f38e30a", 1 } }, + [EquipmentSlots.SecuredContainer], + 1, + botInventory, + botRole, + null, + 0, + true + ); + + // AFAK + AddLootFromPool( + new() { { "60098ad7c2240c0fe85c570a", 1 } }, + [EquipmentSlots.SecuredContainer], + 10, + botInventory, + botRole, + null, + 0, + true + ); } /// @@ -414,16 +460,18 @@ public class BotLootGenerator /// Total value of loot allowed in roubles /// Is bot being generated for a pmc /// - public void AddLootFromPool( + public void AddLootFromPool + ( Dictionary pool, List equipmentSlots, double totalItemCount, BotBaseInventory inventoryToAddItemsTo, // TODO: type for containersIdFull was Set string botRole, ItemSpawnLimitSettings itemSpawnLimits, - List containersIdFull, double totalValueLimitRub = 0, - bool isPmc = false) + bool isPmc = false, + List containersIdFull = null + ) { throw new NotImplementedException(); } @@ -482,7 +530,7 @@ public class BotLootGenerator /// /// Role the bot has /// - public void InitItemLimitArray(string botRole, Dictionary limitCount) + public void InitItemLimitArray(string botRole, Dictionary limitCount) { throw new NotImplementedException(); } @@ -527,7 +575,7 @@ public class BotLootGenerator /// /// what role does the bot have /// Dictionary of tplIds and limit - public Dictionary GetItemSpawnLimitsForBotType(string botRole) + public Dictionary GetItemSpawnLimitsForBotType(string botRole) { throw new NotImplementedException(); } diff --git a/Core/Models/Spt/Bots/ItemSpawnLimitSettings.cs b/Core/Models/Spt/Bots/ItemSpawnLimitSettings.cs index 79a5e56e..10305b9e 100644 --- a/Core/Models/Spt/Bots/ItemSpawnLimitSettings.cs +++ b/Core/Models/Spt/Bots/ItemSpawnLimitSettings.cs @@ -5,8 +5,8 @@ namespace Core.Models.Spt.Bots; public class ItemSpawnLimitSettings { [JsonPropertyName("currentLimits")] - public Dictionary? CurrentLimits { get; set; } + public Dictionary? CurrentLimits { get; set; } [JsonPropertyName("globalLimits")] - public Dictionary? GlobalLimits { get; set; } -} \ No newline at end of file + public Dictionary? GlobalLimits { get; set; } +}