From eff5f14e5cdabdb54758b0339d475b383d9e8852 Mon Sep 17 00:00:00 2001 From: W1ngZ Date: Sun, 25 Aug 2024 07:56:48 +0000 Subject: [PATCH] Added feature to keep daily quest type when replacing. Refering issue #745 (!400) ## Added: * Config to keep daily quest type ## Changed: * changeRepeatableQuest to check if the daily quest type should be kept the same Co-authored-by: W1ngZ Reviewed-on: https://dev.sp-tarkov.com/SPT/Server/pulls/400 Co-authored-by: W1ngZ Co-committed-by: W1ngZ --- project/assets/configs/quest.json | 3 ++- project/src/controllers/RepeatableQuestController.ts | 4 ++++ project/src/models/spt/config/IQuestConfig.ts | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/project/assets/configs/quest.json b/project/assets/configs/quest.json index 30c3c9cb..a51fe3b7 100644 --- a/project/assets/configs/quest.json +++ b/project/assets/configs/quest.json @@ -980,7 +980,8 @@ "rewardBlacklist": ["627bce33f21bc425b06ab967", "59f32c3b86f77472a31742f0", "59f32bb586f774757e1e8442"], "rewardAmmoStackMinSize": 5, "freeChangesAvailable": 2, - "freeChanges": 2 + "freeChanges": 2, + "keepDailyQuestTypeOnReplacement": false }, { "id": "618035d38012292db3081bf0", diff --git a/project/src/controllers/RepeatableQuestController.ts b/project/src/controllers/RepeatableQuestController.ts index a1751b09..de10d1ed 100644 --- a/project/src/controllers/RepeatableQuestController.ts +++ b/project/src/controllers/RepeatableQuestController.ts @@ -513,6 +513,10 @@ export class RepeatableQuestController { (config) => config.name === repeatablesInProfile.name, ); + // If the configuration dictates to replace with the same quest type, adjust the available quest types + if (repeatableConfig?.keepDailyQuestTypeOnReplacement) { + repeatableConfig.types = [questToReplace.type]; + } // Generate meta-data for what type/levelrange of quests can be generated for player const allowedQuestTypes = this.generateQuestPool(repeatableConfig, pmcData.Info.Level); const newRepeatableQuest = this.attemptToGenerateRepeatableQuest(pmcData, allowedQuestTypes, repeatableConfig); diff --git a/project/src/models/spt/config/IQuestConfig.ts b/project/src/models/spt/config/IQuestConfig.ts index 4ca2d9dc..d119b420 100644 --- a/project/src/models/spt/config/IQuestConfig.ts +++ b/project/src/models/spt/config/IQuestConfig.ts @@ -55,6 +55,7 @@ export interface IRepeatableQuestConfig { rewardAmmoStackMinSize: number; freeChangesAvailable: number; freeChanges: number; + keepDailyQuestTypeOnReplacement: boolean; } export interface IRewardScaling {