Add missing validation checks to ammo cache generation for scav case
This commit is contained in:
parent
d609d4b41a
commit
f50a400cde
@ -96,11 +96,12 @@ export class ScavCaseRewardGenerator
|
|||||||
*/
|
*/
|
||||||
protected cacheDbItems(): void
|
protected cacheDbItems(): void
|
||||||
{
|
{
|
||||||
|
// TODO: pre-loop and get array of valid items, e.g. non-node/non-blacklisted, then loop over those results for below code
|
||||||
|
|
||||||
|
// Get an array of seasonal items that should not be shown right now as seasonal event is not active
|
||||||
|
const inactiveSeasonalItems = this.seasonalEventService.getInactiveSeasonalEventItems();
|
||||||
if (!this.dbItemsCache)
|
if (!this.dbItemsCache)
|
||||||
{
|
{
|
||||||
// Get an array of seasonal items that should not be shown right now as seasonal event is not active
|
|
||||||
const seasonalItems = this.seasonalEventService.getInactiveSeasonalEventItems();
|
|
||||||
|
|
||||||
this.dbItemsCache = Object.values(this.databaseServer.getTables().templates.items).filter((item) =>
|
this.dbItemsCache = Object.values(this.databaseServer.getTables().templates.items).filter((item) =>
|
||||||
{
|
{
|
||||||
// Base "Item" item has no parent, ignore it
|
// Base "Item" item has no parent, ignore it
|
||||||
@ -129,7 +130,7 @@ export class ScavCaseRewardGenerator
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Globally blacklisted
|
// Globally reward-blacklisted
|
||||||
if (this.itemFilterService.isItemRewardBlacklisted(item._id))
|
if (this.itemFilterService.isItemRewardBlacklisted(item._id))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -146,7 +147,7 @@ export class ScavCaseRewardGenerator
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seasonalItems.includes(item._id))
|
if (inactiveSeasonalItems.includes(item._id))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -176,6 +177,32 @@ export class ScavCaseRewardGenerator
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip item if item id is on blacklist
|
||||||
|
if (
|
||||||
|
this.scavCaseConfig.rewardItemBlacklist.includes(item._id)
|
||||||
|
|| this.itemFilterService.isItemBlacklisted(item._id)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Globally reward-blacklisted
|
||||||
|
if (this.itemFilterService.isItemRewardBlacklisted(item._id))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.scavCaseConfig.allowBossItemsAsRewards && this.itemFilterService.isBossItem(item._id))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip seasonal items
|
||||||
|
if (inactiveSeasonalItems.includes(item._id))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Skip ammo that doesn't stack as high as value in config
|
// Skip ammo that doesn't stack as high as value in config
|
||||||
if (item._props.StackMaxSize < this.scavCaseConfig.ammoRewards.minStackSize)
|
if (item._props.StackMaxSize < this.scavCaseConfig.ammoRewards.minStackSize)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user