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": { "items": {
"backpackLoot": { "backpackLoot": {
"weights": { "weights": {
"0": 1, "0": 0,
"1": 1, "1": 0,
"2": 2, "2": 0,
"3": 1, "3": 0,
"4": 1, "4": 8,
"5": 1, "5": 5,
"6": 1, "6": 2,
"7": 0 "7": 1,
"10": 1
}, },
"whitelist": [] "whitelist": []
}, },
@ -2074,10 +2075,7 @@
"weights": { "weights": {
"0": 1, "0": 1,
"1": 2, "1": 2,
"2": 1, "2": 1
"3": 1,
"4": 0,
"5": 0
}, },
"whitelist": [] "whitelist": []
}, },
@ -2095,15 +2093,15 @@
"1": 0, "1": 0,
"2": 1, "2": 1,
"3": 3, "3": 3,
"4": 1 "4": 0
}, },
"whitelist": [] "whitelist": []
}, },
"pocketLoot": { "pocketLoot": {
"weights": { "weights": {
"0": 1, "0": 1,
"1": 6, "1": 3,
"2": 3, "2": 6,
"3": 1, "3": 1,
"4": 1 "4": 1
}, },

View File

@ -205,6 +205,18 @@ export class BotLootGenerator
this.pmcConfig.maxPocketLootTotalRub, this.pmcConfig.maxPocketLootTotalRub,
isPmc, 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[]; backpackLoot: ITemplateItem[];
pocketLoot: ITemplateItem[]; pocketLoot: ITemplateItem[];
vestLoot: ITemplateItem[]; vestLoot: ITemplateItem[];
secureLoot: ITemplateItem[];
combinedPoolLoot: ITemplateItem[]; combinedPoolLoot: ITemplateItem[];
specialItems: ITemplateItem[]; specialItems: ITemplateItem[];
@ -20,6 +21,7 @@ export enum LootCacheType
BACKPACK = "Backpack", BACKPACK = "Backpack",
POCKET = "Pocket", POCKET = "Pocket",
VEST = "Vest", VEST = "Vest",
SECURE = "SecuredContainer",
COMBINED = "Combined", COMBINED = "Combined",
HEALING_ITEMS = "HealingItems", HEALING_ITEMS = "HealingItems",
DRUG_ITEMS = "DrugItems", DRUG_ITEMS = "DrugItems",

View File

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