mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-12 15:50:42 -05:00
Moved profile quest management code into its own function
This commit is contained in:
parent
dd5d26fe36
commit
4b2620093e
@ -560,14 +560,7 @@ export class RepeatableQuestController {
|
||||
`Removing: ${repeatableConfig.name} quest: ${questToReplace._id} from trader: ${questToReplace.traderId} as its been replaced`,
|
||||
);
|
||||
|
||||
// Find quest we're replacing in pmc profile quests array and remove it
|
||||
this.questHelper.findAndRemoveQuestFromArrayIfExists(questToReplace._id, pmcData.Quests);
|
||||
|
||||
// Find quest we're replacing in scav profile quests array and remove it
|
||||
this.questHelper.findAndRemoveQuestFromArrayIfExists(
|
||||
questToReplace._id,
|
||||
fullProfile.characters.scav?.Quests ?? [],
|
||||
);
|
||||
this.removeQuestFromProfile(fullProfile, questToReplace._id);
|
||||
|
||||
// Add new quests replacement cost to profile
|
||||
repeatablesOfTypeInProfile.changeRequirement[newRepeatableQuest._id] = {
|
||||
@ -612,6 +605,21 @@ export class RepeatableQuestController {
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the provided quest from pmc and scav character profiles
|
||||
* @param fullProfile Profile to remove quest from
|
||||
* @param questToReplaceId Quest id to remove from profile
|
||||
*/
|
||||
protected removeQuestFromProfile(fullProfile: ISptProfile, questToReplaceId: string): void {
|
||||
// Find quest we're replacing in pmc profile quests array and remove it
|
||||
this.questHelper.findAndRemoveQuestFromArrayIfExists(questToReplaceId, fullProfile.characters.pmc.Quests);
|
||||
|
||||
// Find quest we're replacing in scav profile quests array and remove it
|
||||
if (fullProfile.characters.scav) {
|
||||
this.questHelper.findAndRemoveQuestFromArrayIfExists(questToReplaceId, fullProfile.characters.scav.Quests);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a repeatable (daily/weekly/scav) from a players profile by its id
|
||||
* @param questId Id of quest to find
|
||||
|
Loading…
x
Reference in New Issue
Block a user