diff --git a/project/src/controllers/InraidController.ts b/project/src/controllers/InraidController.ts index 98cb62a4..dfcb2330 100644 --- a/project/src/controllers/InraidController.ts +++ b/project/src/controllers/InraidController.ts @@ -123,12 +123,15 @@ export class InraidController protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void { const serverProfile = this.saveServer.getProfile(sessionID); + const locationName = serverProfile.inraid.location.toLowerCase(); const map: ILocationBase = this.databaseServer.getTables().locations[locationName].base; const mapHasInsuranceEnabled = map.Insurance; - let serverPmcProfile = serverProfile.characters.pmc; + const serverPmcProfile = serverProfile.characters.pmc; + const serverScavProfile = serverProfile.characters.scav; + const isDead = this.isPlayerDead(postRaidRequest.exit); const preRaidGear = this.inRaidHelper.getPlayerGear(serverPmcProfile.Inventory.items); @@ -137,6 +140,8 @@ export class InraidController this.inRaidHelper.updateProfileBaseStats(serverPmcProfile, postRaidRequest, sessionID); this.inRaidHelper.updatePmcProfileDataPostRaid(serverPmcProfile, postRaidRequest, sessionID); + this.mergePmcAndScavEncyclopedias(serverPmcProfile.Encyclopedia, serverScavProfile.Encyclopedia); + // Check for exit status this.markOrRemoveFoundInRaidItems(postRaidRequest); @@ -149,7 +154,7 @@ export class InraidController this.inRaidHelper.addUpdToMoneyFromRaid(postRaidRequest.profile.Inventory.items); // Purge profile of equipment/container items - serverPmcProfile = this.inRaidHelper.setInventory(sessionID, serverPmcProfile, postRaidRequest.profile); + this.inRaidHelper.setInventory(sessionID, serverPmcProfile, postRaidRequest.profile); this.healthHelper.saveVitality(serverPmcProfile, postRaidRequest.health, sessionID); @@ -191,7 +196,7 @@ export class InraidController ); this.matchBotDetailsCacheService.clearCache(); - serverPmcProfile = this.performPostRaidActionsWhenDead(postRaidRequest, serverPmcProfile, sessionID); + this.performPostRaidActionsWhenDead(postRaidRequest, serverPmcProfile, sessionID); } else { @@ -504,11 +509,11 @@ export class InraidController ): void { // Update scav profile inventory - const updatedScavData = this.inRaidHelper.setInventory(sessionID, scavData, offraidData.profile); + this.inRaidHelper.setInventory(sessionID, scavData, offraidData.profile); // Reset scav hp and save to json this.healthHelper.resetVitality(sessionID); - this.saveServer.getProfile(sessionID).characters.scav = updatedScavData; + this.saveServer.getProfile(sessionID).characters.scav = scavData; // Scav karma this.handlePostRaidPlayerScavKarmaChanges(pmcData, offraidData); diff --git a/project/src/generators/PlayerScavGenerator.ts b/project/src/generators/PlayerScavGenerator.ts index 035d91fc..3757e815 100644 --- a/project/src/generators/PlayerScavGenerator.ts +++ b/project/src/generators/PlayerScavGenerator.ts @@ -119,7 +119,7 @@ export class PlayerScavGenerator scavData.TaskConditionCounters = existingScavDataClone.TaskConditionCounters ?? {}; scavData.Notes = existingScavDataClone.Notes ?? { Notes: [] }; scavData.WishList = existingScavDataClone.WishList ?? []; - scavData.Encyclopedia = existingScavDataClone.Encyclopedia ?? {}; + scavData.Encyclopedia = pmcDataClone.Encyclopedia; // Add an extra labs card to pscav backpack based on config chance if (this.randomUtil.getChance100(playerScavKarmaSettings.labsAccessCardChancePercent)) diff --git a/project/src/helpers/InRaidHelper.ts b/project/src/helpers/InRaidHelper.ts index 810f9bbc..edca7886 100644 --- a/project/src/helpers/InRaidHelper.ts +++ b/project/src/helpers/InRaidHelper.ts @@ -181,6 +181,7 @@ export class InRaidHelper profileData.Info.Level = saveProgressRequest.profile.Info.Level; profileData.Skills = saveProgressRequest.profile.Skills; profileData.Stats.Eft = saveProgressRequest.profile.Stats.Eft; + profileData.Encyclopedia = saveProgressRequest.profile.Encyclopedia; profileData.TaskConditionCounters = saveProgressRequest.profile.TaskConditionCounters; @@ -593,9 +594,8 @@ export class InRaidHelper * @param sessionID Session id * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid - * @returns Updated profile */ - public setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData + public setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void { // Store insurance (as removeItem() removes insurance also) const insured = this.jsonUtil.clone(serverProfile.InsuredItems); @@ -609,8 +609,6 @@ export class InRaidHelper serverProfile.Inventory.items = [...postRaidProfile.Inventory.items, ...serverProfile.Inventory.items]; serverProfile.Inventory.fastPanel = postRaidProfile.Inventory.fastPanel; // Quick access items bar serverProfile.InsuredItems = insured; - - return serverProfile; } /**