From ad95b227dd47d1b09aa041bcc8a2df5eeb77c48e Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 9 Oct 2024 10:40:32 +0100 Subject: [PATCH] Added optional blacklist functionality to `generateReward()` --- .../src/generators/RepeatableQuestRewardGenerator.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/project/src/generators/RepeatableQuestRewardGenerator.ts b/project/src/generators/RepeatableQuestRewardGenerator.ts index edd27ddc..8710d1ed 100644 --- a/project/src/generators/RepeatableQuestRewardGenerator.ts +++ b/project/src/generators/RepeatableQuestRewardGenerator.ts @@ -77,6 +77,7 @@ export class RepeatableQuestRewardGenerator { traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig, + rewardTplBlacklist?: string[], ): IQuestRewards { // Get vars to configure rewards with const rewardParams = this.getQuestRewardValues(repeatableConfig.rewardScaling, difficulty, pmcLevel); @@ -126,7 +127,15 @@ export class RepeatableQuestRewardGenerator { } } - const inBudgetRewardItemPool = this.chooseRewardItemsWithinBudget(repeatableConfig, itemRewardBudget, traderId); + let inBudgetRewardItemPool = this.chooseRewardItemsWithinBudget(repeatableConfig, itemRewardBudget, traderId); + if (rewardTplBlacklist) { + // Filter reward pool of items from blacklist, only use if there's at least 1 item remaining + const filteredRewardItemPool = inBudgetRewardItemPool.filter((x) => !rewardTplBlacklist.includes(x._id)); + if (filteredRewardItemPool.length > 0) { + inBudgetRewardItemPool = filteredRewardItemPool; + } + } + this.logger.debug( `Generating daily quest for: ${traderId} with budget: ${itemRewardBudget} totalling: ${rewardParams.rewardNumItems} items`, );