From 6b8fadef40011a002d84320f03e9129b9ef67e9f Mon Sep 17 00:00:00 2001 From: Dev Date: Sun, 30 Jul 2023 11:30:31 +0100 Subject: [PATCH] Save trader standing changes post-raid --- project/src/helpers/InRaidHelper.ts | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/project/src/helpers/InRaidHelper.ts b/project/src/helpers/InRaidHelper.ts index 6d4635b9..9f6e13d5 100644 --- a/project/src/helpers/InRaidHelper.ts +++ b/project/src/helpers/InRaidHelper.ts @@ -1,7 +1,7 @@ import { inject, injectable } from "tsyringe"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Quest, Victim } from "../models/eft/common/tables/IBotBase"; +import { Quest, TraderInfo, Victim } from "../models/eft/common/tables/IBotBase"; import { Item } from "../models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IFailQuestRequestData } from "../models/eft/quests/IFailQuestRequestData"; @@ -145,6 +145,8 @@ export class InRaidHelper // Transfer effects from request to profile this.transferPostRaidLimbEffectsToProfile(saveProgressRequest, profileData); + this.applyTraderStandingAdjustments(profileData.TradersInfo, saveProgressRequest.profile.TradersInfo); + profileData.SurvivorClass = saveProgressRequest.profile.SurvivorClass; // add experience points @@ -164,6 +166,7 @@ export class InRaidHelper return profileData; } + /** * Look for quests not are now status = fail that were not failed pre-raid and run the failQuest() function * @param sessionId Player id @@ -240,6 +243,25 @@ export class InRaidHelper } } + protected applyTraderStandingAdjustments(preRaid: Record, postRaid: Record): void + { + for (const traderId in postRaid) + { + const preRaidTrader = preRaid[traderId]; + const postRaidTrader = postRaid[traderId]; + if (!(preRaidTrader && postRaidTrader)) + { + continue; + } + + if (postRaidTrader.standing !== preRaidTrader.standing) + { + preRaidTrader.standing = postRaidTrader.standing; + } + + } + } + /** * Some maps have one-time-use keys (e.g. Labs * Remove the relevant key from an inventory based on the post-raid request data passed in