diff --git a/project/assets/configs/quest.json b/project/assets/configs/quest.json index 40302033..280a9817 100644 --- a/project/assets/configs/quest.json +++ b/project/assets/configs/quest.json @@ -131,6 +131,7 @@ } }, "repeatableQuests": [{ + "id": "615ffc701c97c768137e719b", "name": "Daily", "side": "Pmc", "types": [ @@ -681,6 +682,7 @@ "rewardBlacklist": ["627bce33f21bc425b06ab967"], "rewardAmmoStackMinSize": 20 }, { + "id": "618035d38012292db3081bf0", "name": "Weekly", "side": "Pmc", "types": [ @@ -1295,6 +1297,7 @@ "rewardBlacklist": ["627bce33f21bc425b06ab967"], "rewardAmmoStackMinSize": 15 }, { + "id": "62825ef60e88d037dc1eb426", "name": "Daily_Savage", "side": "Scav", "types": [ diff --git a/project/src/controllers/QuestController.ts b/project/src/controllers/QuestController.ts index 27f4d516..16159da6 100644 --- a/project/src/controllers/QuestController.ts +++ b/project/src/controllers/QuestController.ts @@ -382,11 +382,13 @@ export class QuestController this.timeUtil.getHoursAsSeconds(this.questConfig.redeemTime)); const repeatableSettings = pmcData.RepeatableQuests.find(x => x.name === repeatableQuestProfile.sptRepatableGroupName); + const change = {}; + change[repeatableQuestProfile._id] = repeatableSettings.changeRequirement[repeatableQuestProfile._id]; const responseData: IPmcDataRepeatableQuest = { id: repeatableSettings.id, name: repeatableSettings.name, endTime: repeatableSettings.endTime, - changeRequirement: repeatableSettings.changeRequirement, + changeRequirement: change, activeQuests: [repeatableQuestProfile], inactiveQuests: [] }; diff --git a/project/src/controllers/RepeatableQuestController.ts b/project/src/controllers/RepeatableQuestController.ts index 37c89cf1..10503c18 100644 --- a/project/src/controllers/RepeatableQuestController.ts +++ b/project/src/controllers/RepeatableQuestController.ts @@ -88,16 +88,16 @@ export class RepeatableQuestController for (const repeatableConfig of this.questConfig.repeatableQuests) { // get daily/weekly data from profile, add empty object if missing - const currentRepeatableType = this.getRepeatableQuestSubTypeFromProfile(repeatableConfig, pmcData); + const currentRepeatableQuestType = this.getRepeatableQuestSubTypeFromProfile(repeatableConfig, pmcData); if (repeatableConfig.side === "Pmc" && pmcData.Info.Level >= repeatableConfig.minPlayerLevel || repeatableConfig.side === "Scav" && scavQuestUnlocked) { - if (time > currentRepeatableType.endTime - 1) + if (time > currentRepeatableQuestType.endTime - 1) { - currentRepeatableType.endTime = time + repeatableConfig.resetTime; - currentRepeatableType.inactiveQuests = []; + currentRepeatableQuestType.endTime = time + repeatableConfig.resetTime; + currentRepeatableQuestType.inactiveQuests = []; this.logger.debug(`Generating new ${repeatableConfig.name}`); // put old quests to inactive (this is required since only then the client makes them fail due to non-completion) @@ -106,7 +106,7 @@ export class RepeatableQuestController // and remove them from the PMC's Quests and RepeatableQuests[i].activeQuests const questsToKeep = []; //for (let i = 0; i < currentRepeatable.activeQuests.length; i++) - for (const activeQuest of currentRepeatableType.activeQuests) + for (const activeQuest of currentRepeatableQuestType.activeQuests) { // check if the quest is ready to be completed, if so, don't remove it const quest = pmcData.Quests.filter(q => q.qid === activeQuest._id); @@ -121,9 +121,9 @@ export class RepeatableQuestController } this.profileFixerService.removeDanglingConditionCounters(pmcData); pmcData.Quests = pmcData.Quests.filter(q => q.qid !== activeQuest._id); - currentRepeatableType.inactiveQuests.push(activeQuest); + currentRepeatableQuestType.inactiveQuests.push(activeQuest); } - currentRepeatableType.activeQuests = questsToKeep; + currentRepeatableQuestType.activeQuests = questsToKeep; // introduce a dynamic quest pool to avoid duplicates const questTypePool = this.generateQuestPool(repeatableConfig, pmcData.Info.Level); @@ -155,7 +155,7 @@ export class RepeatableQuestController break; } quest.side = repeatableConfig.side; - currentRepeatableType.activeQuests.push(quest); + currentRepeatableQuestType.activeQuests.push(quest); } } else @@ -165,21 +165,21 @@ export class RepeatableQuestController } // create stupid redundant change requirements from quest data - for (const quest of currentRepeatableType.activeQuests) + for (const quest of currentRepeatableQuestType.activeQuests) { - currentRepeatableType.changeRequirement[quest._id] = { + currentRepeatableQuestType.changeRequirement[quest._id] = { changeCost: quest.changeCost, changeStandingCost: quest.changeStandingCost }; } returnData.push({ - id: this.objectId.generate(), - name: currentRepeatableType.name, - endTime: currentRepeatableType.endTime, - activeQuests: currentRepeatableType.activeQuests, - inactiveQuests: currentRepeatableType.inactiveQuests, - changeRequirement: currentRepeatableType.changeRequirement + id: repeatableConfig.id, + name: currentRepeatableQuestType.name, + endTime: currentRepeatableQuestType.endTime, + activeQuests: currentRepeatableQuestType.activeQuests, + inactiveQuests: currentRepeatableQuestType.inactiveQuests, + changeRequirement: currentRepeatableQuestType.changeRequirement }); } @@ -199,6 +199,7 @@ export class RepeatableQuestController if (!repeatableQuestDetails) { repeatableQuestDetails = { + id: repeatableConfig.id, name: repeatableConfig.name, activeQuests: [], inactiveQuests: [], diff --git a/project/src/models/eft/common/tables/IRepeatableQuests.ts b/project/src/models/eft/common/tables/IRepeatableQuests.ts index b60710b7..2f9a63bc 100644 --- a/project/src/models/eft/common/tables/IRepeatableQuests.ts +++ b/project/src/models/eft/common/tables/IRepeatableQuests.ts @@ -63,6 +63,7 @@ export interface IRepeatableQuest rewards: IRewards conditions: IConditions side: string + questStatus: any name: string note: string description: string diff --git a/project/src/models/spt/config/IQuestConfig.ts b/project/src/models/spt/config/IQuestConfig.ts index 7539bf7b..64051d0e 100644 --- a/project/src/models/spt/config/IQuestConfig.ts +++ b/project/src/models/spt/config/IQuestConfig.ts @@ -42,6 +42,7 @@ export interface IEventQuestData export interface IRepeatableQuestConfig { + id: string; name: string side: string types: string[]