Store and process secure container loot items for bots

Give gifter more items
This commit is contained in:
Dev 2024-01-18 12:07:32 +00:00
parent f6192f1891
commit bb741f681d
4 changed files with 36 additions and 18 deletions

View File

@ -2051,14 +2051,15 @@
"items": {
"backpackLoot": {
"weights": {
"0": 1,
"1": 1,
"2": 2,
"3": 1,
"4": 1,
"5": 1,
"6": 1,
"7": 0
"0": 0,
"1": 0,
"2": 0,
"3": 0,
"4": 8,
"5": 5,
"6": 2,
"7": 1,
"10": 1
},
"whitelist": []
},
@ -2074,10 +2075,7 @@
"weights": {
"0": 1,
"1": 2,
"2": 1,
"3": 1,
"4": 0,
"5": 0
"2": 1
},
"whitelist": []
},
@ -2095,15 +2093,15 @@
"1": 0,
"2": 1,
"3": 3,
"4": 1
"4": 0
},
"whitelist": []
},
"pocketLoot": {
"weights": {
"0": 1,
"1": 6,
"2": 3,
"1": 3,
"2": 6,
"3": 1,
"4": 1
},

View File

@ -205,6 +205,18 @@ export class BotLootGenerator
this.pmcConfig.maxPocketLootTotalRub,
isPmc,
);
// Secure
this.addLootFromPool(
this.botLootCacheService.getLootFromCache(botRole, isPmc, LootCacheType.SECURE, botJsonTemplate),
[EquipmentSlots.SECURED_CONTAINER],
100,
botInventory,
botRole,
false,
-1,
isPmc,
);
}
/**

View File

@ -5,6 +5,7 @@ export interface IBotLootCache
backpackLoot: ITemplateItem[];
pocketLoot: ITemplateItem[];
vestLoot: ITemplateItem[];
secureLoot: ITemplateItem[];
combinedPoolLoot: ITemplateItem[];
specialItems: ITemplateItem[];
@ -20,6 +21,7 @@ export enum LootCacheType
BACKPACK = "Backpack",
POCKET = "Pocket",
VEST = "Vest",
SECURE = "SecuredContainer",
COMBINED = "Combined",
HEALING_ITEMS = "HealingItems",
DRUG_ITEMS = "DrugItems",

View File

@ -69,6 +69,8 @@ export class BotLootCacheService
return this.lootCache[botRole].pocketLoot;
case LootCacheType.VEST:
return this.lootCache[botRole].vestLoot;
case LootCacheType.SECURE:
return this.lootCache[botRole].secureLoot;
case LootCacheType.COMBINED:
return this.lootCache[botRole].combinedPoolLoot;
case LootCacheType.HEALING_ITEMS:
@ -107,6 +109,7 @@ export class BotLootCacheService
const backpackLootTemplates: ITemplateItem[] = [];
const pocketLootTemplates: ITemplateItem[] = [];
const vestLootTemplates: ITemplateItem[] = [];
const secureLootTemplates: ITemplateItem[] = [];
const combinedPoolTemplates: ITemplateItem[] = [];
if (isPmc)
@ -143,15 +146,16 @@ export class BotLootCacheService
this.addUniqueItemsToPool(vestLootTemplates, itemsToAdd);
break;
case "securedcontainer":
// Don't add these items to loot pool
itemsToAdd = pool.map((lootTpl: string) => items[lootTpl]);
this.addUniqueItemsToPool(secureLootTemplates, itemsToAdd);
break;
default:
itemsToAdd = pool.map((lootTpl: string) => items[lootTpl]);
this.addUniqueItemsToPool(backpackLootTemplates, itemsToAdd);
}
// Add items to combined pool if any exist
if (Object.keys(itemsToAdd).length > 0)
// Add items to combined pool if any exist (excluding secured)
if (Object.keys(itemsToAdd).length > 0 && slot.toLowerCase() !== "securedcontainer")
{
this.addUniqueItemsToPool(combinedPoolTemplates, itemsToAdd);
}
@ -231,6 +235,7 @@ export class BotLootCacheService
this.lootCache[botRole].backpackLoot = backpackLootItems;
this.lootCache[botRole].pocketLoot = pocketLootItems;
this.lootCache[botRole].vestLoot = vestLootItems;
this.lootCache[botRole].secureLoot = secureLootTemplates;
}
/**
@ -328,6 +333,7 @@ export class BotLootCacheService
backpackLoot: [],
pocketLoot: [],
vestLoot: [],
secureLoot: [],
combinedPoolLoot: [],
specialItems: [],