Improve handling of profileChanges
, dont overwrite existing data when adding new objects
This commit is contained in:
parent
288b7cf654
commit
67f7eb59c5
@ -329,7 +329,7 @@ export class HideoutController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param output Objet to send to client
|
||||
* @param output Object to send to client
|
||||
* @param sessionID Session/player id
|
||||
* @param areaType Hideout area that had stash added
|
||||
* @param hideoutDbData Hideout area that caused addition of stash
|
||||
@ -1137,13 +1137,14 @@ export class HideoutController
|
||||
// Add all improvemets to output object
|
||||
const improvements = hideoutDbData.stages[profileHideoutArea.level].improvements;
|
||||
const timestamp = this.timeUtil.getTimestamp();
|
||||
|
||||
if (!output.profileChanges[sessionId].improvements)
|
||||
{
|
||||
output.profileChanges[sessionId].improvements = {};
|
||||
}
|
||||
|
||||
for (const improvement of improvements)
|
||||
{
|
||||
if (!output.profileChanges[sessionId].improvements)
|
||||
{
|
||||
output.profileChanges[sessionId].improvements = {};
|
||||
}
|
||||
|
||||
const improvementDetails = {
|
||||
completed: false,
|
||||
improveCompleteTimestamp: timestamp + improvement.improvementTime,
|
||||
|
@ -419,7 +419,12 @@ export class QuestController
|
||||
activeQuests: [repeatableQuestProfile],
|
||||
inactiveQuests: [],
|
||||
};
|
||||
acceptQuestResponse.profileChanges[sessionID].repeatableQuests = [responseData];
|
||||
|
||||
if (!acceptQuestResponse.profileChanges[sessionID].repeatableQuests)
|
||||
{
|
||||
acceptQuestResponse.profileChanges[sessionID].repeatableQuests = []
|
||||
}
|
||||
acceptQuestResponse.profileChanges[sessionID].repeatableQuests.push(responseData);
|
||||
|
||||
return acceptQuestResponse;
|
||||
}
|
||||
@ -498,7 +503,7 @@ export class QuestController
|
||||
this.addTimeLockedQuestsToProfile(pmcData, [...questDelta, ...questsToFail], body.qid);
|
||||
|
||||
// Inform client of quest changes
|
||||
completeQuestResponse.profileChanges[sessionID].quests = questDelta;
|
||||
completeQuestResponse.profileChanges[sessionID].quests.push(...questDelta);
|
||||
|
||||
// Check if it's a repeatable quest. If so, remove from Quests and repeatable.activeQuests list + move to repeatable.inactiveQuests
|
||||
for (const currentRepeatable of pmcData.RepeatableQuests)
|
||||
|
@ -457,7 +457,11 @@ export class RepeatableQuestController
|
||||
droppedQuestTrader.standing -= changeRequirement.changeStandingCost;
|
||||
|
||||
// Update client output with new repeatable
|
||||
output.profileChanges[sessionID].repeatableQuests = [repeatableToChange];
|
||||
if (!output.profileChanges[sessionID].repeatableQuests)
|
||||
{
|
||||
output.profileChanges[sessionID].repeatableQuests = [];
|
||||
}
|
||||
output.profileChanges[sessionID].repeatableQuests.push(repeatableToChange);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user