Add missing medical filter on backpack loot cache builder

remove hard coded 2 stim limit from assault
This commit is contained in:
Dev 2024-02-27 23:44:23 +00:00
parent 6ca9b23134
commit a1a5aa356a
2 changed files with 26 additions and 18 deletions

View File

@ -300,7 +300,6 @@
"assault": { "assault": {
"5a0c27731526d80618476ac4": 1, "5a0c27731526d80618476ac4": 1,
"5c99f98d86f7745c314214b3": 1, "5c99f98d86f7745c314214b3": 1,
"5448f3a64bdc2d60728b456a": 2,
"5448f3ac4bdc2dce718b4569": 4 "5448f3ac4bdc2dce718b4569": 4
}, },
"marksman": { "marksman": {

View File

@ -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<string, number> = const stimItems: Record<string, number> =
(Object.keys(botJsonTemplate.generation.items.stims.whitelist)?.length > 0) (Object.keys(botJsonTemplate.generation.items.stims.whitelist)?.length > 0)
? botJsonTemplate.generation.items.stims.whitelist ? 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<string, number> = const grenadeItems: Record<string, number> =
(Object.keys(botJsonTemplate.generation.items.grenades.whitelist)?.length > 0) (Object.keys(botJsonTemplate.generation.items.grenades.whitelist)?.length > 0)
? botJsonTemplate.generation.items.grenades.whitelist ? botJsonTemplate.generation.items.grenades.whitelist
@ -268,12 +268,17 @@ export class BotLootCacheService
} }
const itemTemplate = itemResult[1]; const itemTemplate = itemResult[1];
if ( if (
!((this.isBulletOrGrenade(itemTemplate._props) || this.isMagazine(itemTemplate._props)) this.isBulletOrGrenade(itemTemplate._props)
|| this.isGrenade(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) // Get pocket loot (excluding magazines, bullets, grenades, medical and healing items)
@ -287,16 +292,18 @@ export class BotLootCacheService
} }
const itemTemplate = itemResult[1]; const itemTemplate = itemResult[1];
if ( if (
!this.isBulletOrGrenade(itemTemplate._props) this.isBulletOrGrenade(itemTemplate._props)
&& !this.isMagazine(itemTemplate._props) || this.isMagazine(itemTemplate._props)
&& !this.isMedicalItem(itemTemplate._props) || this.isMedicalItem(itemTemplate._props)
&& !this.isGrenade(itemTemplate._props) || this.isGrenade(itemTemplate._props)
&& ("Height" in itemTemplate._props) || !("Height" in itemTemplate._props) // lacks height
&& ("Width" in itemTemplate._props) || !("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) // Get vest loot (excluding magazines, bullets, grenades, medical and healing items)
@ -310,14 +317,16 @@ export class BotLootCacheService
} }
const itemTemplate = itemResult[1]; const itemTemplate = itemResult[1];
if ( if (
!this.isBulletOrGrenade(itemTemplate._props) this.isBulletOrGrenade(itemTemplate._props)
&& !this.isMagazine(itemTemplate._props) || this.isMagazine(itemTemplate._props)
&& !this.isMedicalItem(itemTemplate._props) || this.isMedicalItem(itemTemplate._props)
&& !this.isGrenade(itemTemplate._props) || this.isGrenade(itemTemplate._props)
) )
{ {
filteredVestItems[itemKey] = vestLootPool[itemKey]; continue;
} }
filteredVestItems[itemKey] = vestLootPool[itemKey];
} }
this.lootCache[botRole].healingItems = healingItems; this.lootCache[botRole].healingItems = healingItems;