Add missing IDs to json and pass throughout code

This commit is contained in:
Dev 2023-10-19 21:36:17 +01:00
parent fa2a8c6513
commit 20b9a39cda
5 changed files with 25 additions and 17 deletions

View File

@ -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": [

View File

@ -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: []
};

View File

@ -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: [],

View File

@ -63,6 +63,7 @@ export interface IRepeatableQuest
rewards: IRewards
conditions: IConditions
side: string
questStatus: any
name: string
note: string
description: string

View File

@ -42,6 +42,7 @@ export interface IEventQuestData
export interface IRepeatableQuestConfig
{
id: string;
name: string
side: string
types: string[]