Update PMC encyclopedia post-raid

Update scav encyclopedia during generation to be pmc encyclopedia

Remove redundant return statements from function
This commit is contained in:
Dev 2024-02-13 12:20:30 +00:00
parent 1c63d85649
commit 2e3f624131
3 changed files with 13 additions and 10 deletions

View File

@ -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);

View File

@ -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))

View File

@ -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;
}
/**