Add boss item blacklist and wire into:
airdrops scav cases sealed weapon containers daily quests Default boss item filter to on
This commit is contained in:
parent
4a570b438f
commit
db619a30b3
@ -150,7 +150,8 @@
|
||||
"max": 500
|
||||
}
|
||||
},
|
||||
"armorLevelWhitelist": [0, 4, 5, 6]
|
||||
"armorLevelWhitelist": [0, 4, 5, 6],
|
||||
"allowBossItems": false
|
||||
},
|
||||
"weaponArmor": {
|
||||
"presetCount": {
|
||||
@ -245,7 +246,8 @@
|
||||
"max": 25
|
||||
}
|
||||
},
|
||||
"armorLevelWhitelist": [0, 3, 4, 5, 6]
|
||||
"armorLevelWhitelist": [0, 3, 4, 5, 6],
|
||||
"allowBossItems": false
|
||||
},
|
||||
"foodMedical": {
|
||||
"presetCount": {
|
||||
@ -327,7 +329,8 @@
|
||||
"min": 100,
|
||||
"max": 500
|
||||
}
|
||||
}
|
||||
},
|
||||
"allowBossItems": false
|
||||
},
|
||||
"barter": {
|
||||
"presetCount": {
|
||||
@ -411,7 +414,8 @@
|
||||
"min": 100,
|
||||
"max": 500
|
||||
}
|
||||
}
|
||||
},
|
||||
"allowBossItems": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +154,8 @@
|
||||
"64898602f09d032aa9399d56",
|
||||
"6489870774a806211e4fb685",
|
||||
"6489879db5a2df1c815a04ef"
|
||||
]
|
||||
],
|
||||
"allowBossItems": false
|
||||
},
|
||||
"customMoneyTpls": []
|
||||
}
|
||||
|
@ -60,5 +60,33 @@
|
||||
"5ae089fb5acfc408fb13989b",
|
||||
|
||||
"6241c2c2117ad530666a5108"
|
||||
],
|
||||
"bossItems": [
|
||||
"6275303a9f372d6ea97f9ec7",
|
||||
"62a61bbf8ec41a51b34758d2",
|
||||
"628e4dd1f477aa12234918aa",
|
||||
"628b9784bcf6e2659e09b8a2",
|
||||
"628bc7fb408e2b2e9c0801b1",
|
||||
"628baf0b967de16aab5a4f36",
|
||||
"62963c18dbc8ab5f0d382d0b",
|
||||
"628b9c7d45122232a872358f",
|
||||
"5fc64ea372b0dd78d51159dc",
|
||||
"64ca3d3954fc657e230529cc",
|
||||
"64637076203536ad5600c990",
|
||||
"5c0e874186f7745dc7616606",
|
||||
"5c0e842486f77443a74d2976",
|
||||
"5c0e541586f7747fa54205c9",
|
||||
"5b3b713c5acfc4330140bd8d",
|
||||
"5e997f0b86f7741ac73993e2",
|
||||
"5d08d21286f774736e7c94c3",
|
||||
"6087e570b998180e9f76dc24",
|
||||
"60a7ad2a2198820d95707a2e",
|
||||
"60a7ad3a0c5cb24b0134664a",
|
||||
"60a7acf20c5cb24b01346648",
|
||||
"636270263f2495c26f00b007",
|
||||
"63626d904aa74b8fe30ab426",
|
||||
"63611865ba5b90db0c0399d1",
|
||||
"5eff09cd30a7dc22fd1ddfed",
|
||||
"5efde6b4f5448336730dbd61"
|
||||
]
|
||||
}
|
||||
|
@ -114,5 +114,6 @@
|
||||
}
|
||||
},
|
||||
"allowMultipleMoneyRewardsPerRarity": false,
|
||||
"allowMultipleAmmoRewardsPerRarity": true
|
||||
"allowMultipleAmmoRewardsPerRarity": true,
|
||||
"allowBossItemsAsRewards": false
|
||||
}
|
||||
|
@ -188,7 +188,8 @@ export class LocationController
|
||||
itemTypeWhitelist: lootSettingsByType.itemTypeWhitelist,
|
||||
itemLimits: lootSettingsByType.itemLimits,
|
||||
itemStackLimits: lootSettingsByType.itemStackLimits,
|
||||
armorLevelWhitelist: lootSettingsByType.armorLevelWhitelist
|
||||
armorLevelWhitelist: lootSettingsByType.armorLevelWhitelist,
|
||||
allowBossItems: lootSettingsByType.allowBossItems
|
||||
};
|
||||
}
|
||||
}
|
@ -55,8 +55,15 @@ export class LootGenerator
|
||||
|
||||
const tables = this.databaseServer.getTables();
|
||||
const itemBlacklist = this.itemFilterService.getBlacklistedItems();
|
||||
|
||||
itemBlacklist.push(...options.itemBlacklist);
|
||||
|
||||
if (!options.allowBossItems)
|
||||
{
|
||||
const bossItems = this.itemFilterService.getBossItems();
|
||||
itemBlacklist.push(...bossItems);
|
||||
}
|
||||
|
||||
// Handle sealed weapon containers
|
||||
const desiredWeaponCrateCount = this.randomUtil.getInt(options.weaponCrateCount.min, options.weaponCrateCount.max);
|
||||
if (desiredWeaponCrateCount > 0)
|
||||
@ -373,13 +380,14 @@ export class LootGenerator
|
||||
}
|
||||
|
||||
// Get all items of the desired type + not quest items + not globally blacklisted
|
||||
const possibleRewardItems = Object.values(this.databaseServer.getTables().templates.items)
|
||||
const rewardItemPool = Object.values(this.databaseServer.getTables().templates.items)
|
||||
.filter(x => x._parent === rewardTypeId
|
||||
&& x._type.toLowerCase() === "item"
|
||||
&& !this.itemFilterService.isItemBlacklisted(x._id)
|
||||
&& (!containerSettings.allowBossItems && !this.itemFilterService.isBossItem(x._id))
|
||||
&& !x._props.QuestItem);
|
||||
|
||||
if (possibleRewardItems.length === 0)
|
||||
if (rewardItemPool.length === 0)
|
||||
{
|
||||
this.logger.debug(`No items with base type of ${rewardTypeId} found, skipping`);
|
||||
|
||||
@ -389,7 +397,7 @@ export class LootGenerator
|
||||
for (let index = 0; index < rewardCount; index++)
|
||||
{
|
||||
// choose a random item from pool
|
||||
const chosenRewardItem = this.randomUtil.getArrayValue(possibleRewardItems);
|
||||
const chosenRewardItem = this.randomUtil.getArrayValue(rewardItemPool);
|
||||
this.addOrIncrementItemToArray(chosenRewardItem._id, rewards);
|
||||
}
|
||||
}
|
||||
|
@ -939,7 +939,8 @@ export class RepeatableQuestGenerator
|
||||
// rome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
|
||||
valid = !this.itemHelper.isOfBaseclass(tpl, BaseClasses.KEY)
|
||||
&& !this.itemHelper.isOfBaseclass(tpl, BaseClasses.ARMBAND)
|
||||
&& !this.itemFilterService.isItemBlacklisted(tpl);
|
||||
&& !this.itemFilterService.isItemBlacklisted(tpl)
|
||||
&& !this.itemFilterService.isBossItem(tpl);
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
@ -91,10 +91,11 @@ export class ScavCaseRewardGenerator
|
||||
return false;
|
||||
}
|
||||
|
||||
// Skip item if item id is on blacklist
|
||||
// Skip item if item id is on blacklist or boss item
|
||||
if ((item._type !== "Item")
|
||||
|| this.scavCaseConfig.rewardItemBlacklist.includes(item._id)
|
||||
|| this.itemFilterService.isItemBlacklisted(item._id))
|
||||
|| this.itemFilterService.isItemBlacklisted(item._id)
|
||||
|| ( !this.scavCaseConfig.allowBossItemsAsRewards || this.itemFilterService.isBossItem(item._id)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -58,5 +58,7 @@ export interface AirdropLoot
|
||||
itemStackLimits: Record<string, MinMax>
|
||||
/** Armor levels to allow inside crate e.g. [4,5,6] */
|
||||
armorLevelWhitelist?: number[]
|
||||
/** Should boss items be added to airdrop crate */
|
||||
allowBossItems: boolean;
|
||||
}
|
||||
|
@ -29,4 +29,5 @@ export interface ISealedAirdropContainerSettings
|
||||
weaponModRewardLimits: Record<string, MinMax>
|
||||
rewardTypeLimits: Record<string, MinMax>
|
||||
ammoBoxWhitelist: string[]
|
||||
allowBossItems: boolean
|
||||
}
|
@ -3,5 +3,8 @@ import { IBaseConfig } from "./IBaseConfig";
|
||||
export interface IItemConfig extends IBaseConfig
|
||||
{
|
||||
kind: "aki-item"
|
||||
blacklist: string[]
|
||||
/** Items that should be globally blacklisted */
|
||||
blacklist: string[],
|
||||
/** Items that can only be found on bosses */
|
||||
bossItems: string[]
|
||||
}
|
@ -10,8 +10,9 @@ export interface IScavCaseConfig extends IBaseConfig
|
||||
ammoRewards: AmmoRewards
|
||||
rewardItemParentBlacklist: string[]
|
||||
rewardItemBlacklist: string[]
|
||||
allowMultipleMoneyRewardsPerRarity: boolean;
|
||||
allowMultipleAmmoRewardsPerRarity: boolean;
|
||||
allowMultipleMoneyRewardsPerRarity: boolean
|
||||
allowMultipleAmmoRewardsPerRarity: boolean
|
||||
allowBossItemsAsRewards: boolean
|
||||
}
|
||||
|
||||
export interface MoneyRewards
|
||||
|
@ -11,4 +11,5 @@ export interface LootRequest
|
||||
itemLimits: Record<string, number>
|
||||
itemStackLimits: Record<string, MinMax>
|
||||
armorLevelWhitelist: number[]
|
||||
allowBossItems: boolean
|
||||
}
|
@ -10,7 +10,6 @@ import { DatabaseServer } from "../servers/DatabaseServer";
|
||||
@injectable()
|
||||
export class ItemFilterService
|
||||
{
|
||||
protected blacklist: string[] = [];
|
||||
protected itemConfig: IItemConfig ;
|
||||
|
||||
constructor(
|
||||
@ -20,7 +19,6 @@ export class ItemFilterService
|
||||
)
|
||||
{
|
||||
this.itemConfig = this.configServer.getConfig(ConfigTypes.ITEM);
|
||||
this.blacklist = this.itemConfig.blacklist;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -30,7 +28,7 @@ export class ItemFilterService
|
||||
*/
|
||||
public isItemBlacklisted(tpl: string): boolean
|
||||
{
|
||||
return this.blacklist.includes(tpl);
|
||||
return this.itemConfig.blacklist.includes(tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,6 +37,25 @@ export class ItemFilterService
|
||||
*/
|
||||
public getBlacklistedItems(): string[]
|
||||
{
|
||||
return this.blacklist;
|
||||
return this.itemConfig.blacklist;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the provided template id is boss item in config/item.json
|
||||
* @param tpl template id
|
||||
* @returns true if boss item
|
||||
*/
|
||||
public isBossItem(tpl: string): boolean
|
||||
{
|
||||
return this.itemConfig.bossItems.includes(tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return boss items in config/item.json
|
||||
* @returns string array of boss item tempalte ids
|
||||
*/
|
||||
public getBossItems(): string[]
|
||||
{
|
||||
return this.itemConfig.bossItems;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user