Add missing IDs to json and pass throughout code
This commit is contained in:
parent
fa2a8c6513
commit
20b9a39cda
@ -131,6 +131,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"repeatableQuests": [{
|
"repeatableQuests": [{
|
||||||
|
"id": "615ffc701c97c768137e719b",
|
||||||
"name": "Daily",
|
"name": "Daily",
|
||||||
"side": "Pmc",
|
"side": "Pmc",
|
||||||
"types": [
|
"types": [
|
||||||
@ -681,6 +682,7 @@
|
|||||||
"rewardBlacklist": ["627bce33f21bc425b06ab967"],
|
"rewardBlacklist": ["627bce33f21bc425b06ab967"],
|
||||||
"rewardAmmoStackMinSize": 20
|
"rewardAmmoStackMinSize": 20
|
||||||
}, {
|
}, {
|
||||||
|
"id": "618035d38012292db3081bf0",
|
||||||
"name": "Weekly",
|
"name": "Weekly",
|
||||||
"side": "Pmc",
|
"side": "Pmc",
|
||||||
"types": [
|
"types": [
|
||||||
@ -1295,6 +1297,7 @@
|
|||||||
"rewardBlacklist": ["627bce33f21bc425b06ab967"],
|
"rewardBlacklist": ["627bce33f21bc425b06ab967"],
|
||||||
"rewardAmmoStackMinSize": 15
|
"rewardAmmoStackMinSize": 15
|
||||||
}, {
|
}, {
|
||||||
|
"id": "62825ef60e88d037dc1eb426",
|
||||||
"name": "Daily_Savage",
|
"name": "Daily_Savage",
|
||||||
"side": "Scav",
|
"side": "Scav",
|
||||||
"types": [
|
"types": [
|
||||||
|
@ -382,11 +382,13 @@ export class QuestController
|
|||||||
this.timeUtil.getHoursAsSeconds(this.questConfig.redeemTime));
|
this.timeUtil.getHoursAsSeconds(this.questConfig.redeemTime));
|
||||||
|
|
||||||
const repeatableSettings = pmcData.RepeatableQuests.find(x => x.name === repeatableQuestProfile.sptRepatableGroupName);
|
const repeatableSettings = pmcData.RepeatableQuests.find(x => x.name === repeatableQuestProfile.sptRepatableGroupName);
|
||||||
|
const change = {};
|
||||||
|
change[repeatableQuestProfile._id] = repeatableSettings.changeRequirement[repeatableQuestProfile._id];
|
||||||
const responseData: IPmcDataRepeatableQuest = {
|
const responseData: IPmcDataRepeatableQuest = {
|
||||||
id: repeatableSettings.id,
|
id: repeatableSettings.id,
|
||||||
name: repeatableSettings.name,
|
name: repeatableSettings.name,
|
||||||
endTime: repeatableSettings.endTime,
|
endTime: repeatableSettings.endTime,
|
||||||
changeRequirement: repeatableSettings.changeRequirement,
|
changeRequirement: change,
|
||||||
activeQuests: [repeatableQuestProfile],
|
activeQuests: [repeatableQuestProfile],
|
||||||
inactiveQuests: []
|
inactiveQuests: []
|
||||||
};
|
};
|
||||||
|
@ -88,16 +88,16 @@ export class RepeatableQuestController
|
|||||||
for (const repeatableConfig of this.questConfig.repeatableQuests)
|
for (const repeatableConfig of this.questConfig.repeatableQuests)
|
||||||
{
|
{
|
||||||
// get daily/weekly data from profile, add empty object if missing
|
// 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"
|
if (repeatableConfig.side === "Pmc"
|
||||||
&& pmcData.Info.Level >= repeatableConfig.minPlayerLevel
|
&& pmcData.Info.Level >= repeatableConfig.minPlayerLevel
|
||||||
|| repeatableConfig.side === "Scav" && scavQuestUnlocked)
|
|| repeatableConfig.side === "Scav" && scavQuestUnlocked)
|
||||||
{
|
{
|
||||||
if (time > currentRepeatableType.endTime - 1)
|
if (time > currentRepeatableQuestType.endTime - 1)
|
||||||
{
|
{
|
||||||
currentRepeatableType.endTime = time + repeatableConfig.resetTime;
|
currentRepeatableQuestType.endTime = time + repeatableConfig.resetTime;
|
||||||
currentRepeatableType.inactiveQuests = [];
|
currentRepeatableQuestType.inactiveQuests = [];
|
||||||
this.logger.debug(`Generating new ${repeatableConfig.name}`);
|
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)
|
// 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
|
// and remove them from the PMC's Quests and RepeatableQuests[i].activeQuests
|
||||||
const questsToKeep = [];
|
const questsToKeep = [];
|
||||||
//for (let i = 0; i < currentRepeatable.activeQuests.length; i++)
|
//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
|
// 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);
|
const quest = pmcData.Quests.filter(q => q.qid === activeQuest._id);
|
||||||
@ -121,9 +121,9 @@ export class RepeatableQuestController
|
|||||||
}
|
}
|
||||||
this.profileFixerService.removeDanglingConditionCounters(pmcData);
|
this.profileFixerService.removeDanglingConditionCounters(pmcData);
|
||||||
pmcData.Quests = pmcData.Quests.filter(q => q.qid !== activeQuest._id);
|
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
|
// introduce a dynamic quest pool to avoid duplicates
|
||||||
const questTypePool = this.generateQuestPool(repeatableConfig, pmcData.Info.Level);
|
const questTypePool = this.generateQuestPool(repeatableConfig, pmcData.Info.Level);
|
||||||
@ -155,7 +155,7 @@ export class RepeatableQuestController
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
quest.side = repeatableConfig.side;
|
quest.side = repeatableConfig.side;
|
||||||
currentRepeatableType.activeQuests.push(quest);
|
currentRepeatableQuestType.activeQuests.push(quest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -165,21 +165,21 @@ export class RepeatableQuestController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create stupid redundant change requirements from quest data
|
// 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,
|
changeCost: quest.changeCost,
|
||||||
changeStandingCost: quest.changeStandingCost
|
changeStandingCost: quest.changeStandingCost
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
returnData.push({
|
returnData.push({
|
||||||
id: this.objectId.generate(),
|
id: repeatableConfig.id,
|
||||||
name: currentRepeatableType.name,
|
name: currentRepeatableQuestType.name,
|
||||||
endTime: currentRepeatableType.endTime,
|
endTime: currentRepeatableQuestType.endTime,
|
||||||
activeQuests: currentRepeatableType.activeQuests,
|
activeQuests: currentRepeatableQuestType.activeQuests,
|
||||||
inactiveQuests: currentRepeatableType.inactiveQuests,
|
inactiveQuests: currentRepeatableQuestType.inactiveQuests,
|
||||||
changeRequirement: currentRepeatableType.changeRequirement
|
changeRequirement: currentRepeatableQuestType.changeRequirement
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,6 +199,7 @@ export class RepeatableQuestController
|
|||||||
if (!repeatableQuestDetails)
|
if (!repeatableQuestDetails)
|
||||||
{
|
{
|
||||||
repeatableQuestDetails = {
|
repeatableQuestDetails = {
|
||||||
|
id: repeatableConfig.id,
|
||||||
name: repeatableConfig.name,
|
name: repeatableConfig.name,
|
||||||
activeQuests: [],
|
activeQuests: [],
|
||||||
inactiveQuests: [],
|
inactiveQuests: [],
|
||||||
|
@ -63,6 +63,7 @@ export interface IRepeatableQuest
|
|||||||
rewards: IRewards
|
rewards: IRewards
|
||||||
conditions: IConditions
|
conditions: IConditions
|
||||||
side: string
|
side: string
|
||||||
|
questStatus: any
|
||||||
name: string
|
name: string
|
||||||
note: string
|
note: string
|
||||||
description: string
|
description: string
|
||||||
|
@ -42,6 +42,7 @@ export interface IEventQuestData
|
|||||||
|
|
||||||
export interface IRepeatableQuestConfig
|
export interface IRepeatableQuestConfig
|
||||||
{
|
{
|
||||||
|
id: string;
|
||||||
name: string
|
name: string
|
||||||
side: string
|
side: string
|
||||||
types: string[]
|
types: string[]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user