Add sealed crates to airdrops

This commit is contained in:
Dev 2023-06-20 16:59:15 +01:00
parent 0c31719013
commit 26f29e1522
5 changed files with 39 additions and 0 deletions

View File

@ -31,6 +31,10 @@
"min": 12,
"max": 25
},
"weaponCrateCount": {
"min": 0,
"max": 2
},
"itemBlacklist": [
"5e997f0b86f7741ac73993e2",
"5b44abe986f774283e2e3512",
@ -132,6 +136,10 @@
"min": 10,
"max": 20
},
"weaponCrateCount": {
"min": 0,
"max": 2
},
"itemBlacklist": [
"5e997f0b86f7741ac73993e2",
"5b44abe986f774283e2e3512",
@ -204,6 +212,10 @@
"min": 17,
"max": 28
},
"weaponCrateCount": {
"min": 0,
"max": 0
},
"itemBlacklist": [
"5e997f0b86f7741ac73993e2",
"5b44abe986f774283e2e3512",
@ -282,6 +294,10 @@
"min": 16,
"max": 25
},
"weaponCrateCount": {
"min": 0,
"max": 0
},
"itemBlacklist": [
"5e997f0b86f7741ac73993e2",
"5b44abe986f774283e2e3512",

View File

@ -185,6 +185,7 @@ export class LocationController
return {
presetCount: lootSettingsByType.presetCount,
itemCount: lootSettingsByType.itemCount,
weaponCrateCount: lootSettingsByType.weaponCrateCount,
itemBlacklist: lootSettingsByType.itemBlacklist,
itemTypeWhitelist: lootSettingsByType.itemTypeWhitelist,
itemLimits: lootSettingsByType.itemLimits,

View File

@ -57,6 +57,26 @@ export class LootGenerator
const itemBlacklist = this.itemFilterService.getBlacklistedItems();
itemBlacklist.push(...options.itemBlacklist);
// Handle sealed weapon containers
const desiredWeaponCrateCount = this.randomUtil.getInt(options.weaponCrateCount.min, options.weaponCrateCount.max);
if (desiredWeaponCrateCount > 0)
{
// Get list of all sealed containers from db
const sealedWeaponContainerPool = Object.values(tables.templates.items).filter(x => x._name.includes("event_container_airdrop"));
for (let index = 0; index < desiredWeaponCrateCount; index++)
{
// Choose one at random + add to results array
const chosenSealedContainer = this.randomUtil.getArrayValue(sealedWeaponContainerPool);
result.push({
id: this.hashUtil.generate(),
tpl: chosenSealedContainer._id,
isPreset: false,
stackCount: 1
});
}
}
// Get items from items.json that have a type of item + not in global blacklist + basetype is in whitelist
const items = Object.entries(tables.templates.items).filter(x => !itemBlacklist.includes(x[1]._id)
&& x[1]._type.toLowerCase() === "item"

View File

@ -32,6 +32,7 @@ export interface AirdropLoot
{
presetCount?: MinMax
itemCount: MinMax
weaponCrateCount: MinMax
itemBlacklist: string[]
itemTypeWhitelist: string[]
/** key: item base type: value: max count */

View File

@ -4,6 +4,7 @@ export interface LootRequest
{
presetCount: MinMax
itemCount: MinMax
weaponCrateCount: MinMax
itemBlacklist: string[]
itemTypeWhitelist: string[]
/** key: item base type: value: max count */