From a1a5aa356a6dd09fa04d64ccd19d94efec3d41f4 Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 27 Feb 2024 23:44:23 +0000 Subject: [PATCH] Add missing medical filter on backpack loot cache builder remove hard coded 2 stim limit from assault --- project/assets/configs/bot.json | 1 - project/src/services/BotLootCacheService.ts | 43 +++++++++++++-------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/project/assets/configs/bot.json b/project/assets/configs/bot.json index d3bcf84c..3a6c3700 100644 --- a/project/assets/configs/bot.json +++ b/project/assets/configs/bot.json @@ -300,7 +300,6 @@ "assault": { "5a0c27731526d80618476ac4": 1, "5c99f98d86f7745c314214b3": 1, - "5448f3a64bdc2d60728b456a": 2, "5448f3ac4bdc2dce718b4569": 4 }, "marksman": { diff --git a/project/src/services/BotLootCacheService.ts b/project/src/services/BotLootCacheService.ts index 4576509f..44d08524 100644 --- a/project/src/services/BotLootCacheService.ts +++ b/project/src/services/BotLootCacheService.ts @@ -219,7 +219,7 @@ export class BotLootCacheService } } - // Assign whitelisted grendes to bot if any exist + // Assign whitelisted stims to bot if any exist const stimItems: Record = (Object.keys(botJsonTemplate.generation.items.stims.whitelist)?.length > 0) ? botJsonTemplate.generation.items.stims.whitelist @@ -238,7 +238,7 @@ export class BotLootCacheService } } - // Assign whitelisted grendes to bot if any exist + // Assign whitelisted grenades to bot if any exist const grenadeItems: Record = (Object.keys(botJsonTemplate.generation.items.grenades.whitelist)?.length > 0) ? botJsonTemplate.generation.items.grenades.whitelist @@ -268,12 +268,17 @@ export class BotLootCacheService } const itemTemplate = itemResult[1]; if ( - !((this.isBulletOrGrenade(itemTemplate._props) || this.isMagazine(itemTemplate._props)) - || this.isGrenade(itemTemplate._props)) + this.isBulletOrGrenade(itemTemplate._props) + || this.isMagazine(itemTemplate._props) + || this.isMedicalItem(itemTemplate._props) + || this.isGrenade(itemTemplate._props) ) { - filteredBackpackItems[itemKey] = backpackLootPool[itemKey]; + // Is type we dont want as backpack loot, skip + continue; } + + filteredBackpackItems[itemKey] = backpackLootPool[itemKey]; } // Get pocket loot (excluding magazines, bullets, grenades, medical and healing items) @@ -287,16 +292,18 @@ export class BotLootCacheService } const itemTemplate = itemResult[1]; if ( - !this.isBulletOrGrenade(itemTemplate._props) - && !this.isMagazine(itemTemplate._props) - && !this.isMedicalItem(itemTemplate._props) - && !this.isGrenade(itemTemplate._props) - && ("Height" in itemTemplate._props) - && ("Width" in itemTemplate._props) + this.isBulletOrGrenade(itemTemplate._props) + || this.isMagazine(itemTemplate._props) + || this.isMedicalItem(itemTemplate._props) + || this.isGrenade(itemTemplate._props) + || !("Height" in itemTemplate._props) // lacks height + || !("Width" in itemTemplate._props) // lacks width ) { - filteredPocketItems[itemKey] = pocketLootPool[itemKey]; + continue; } + + filteredPocketItems[itemKey] = pocketLootPool[itemKey]; } // Get vest loot (excluding magazines, bullets, grenades, medical and healing items) @@ -310,14 +317,16 @@ export class BotLootCacheService } const itemTemplate = itemResult[1]; if ( - !this.isBulletOrGrenade(itemTemplate._props) - && !this.isMagazine(itemTemplate._props) - && !this.isMedicalItem(itemTemplate._props) - && !this.isGrenade(itemTemplate._props) + this.isBulletOrGrenade(itemTemplate._props) + || this.isMagazine(itemTemplate._props) + || this.isMedicalItem(itemTemplate._props) + || this.isGrenade(itemTemplate._props) ) { - filteredVestItems[itemKey] = vestLootPool[itemKey]; + continue; } + + filteredVestItems[itemKey] = vestLootPool[itemKey]; } this.lootCache[botRole].healingItems = healingItems;