Store the fence rep diff after a raid has concluded, add endpoint to allow retreval of this value
This commit is contained in:
parent
efc3a35200
commit
04aad787d3
@ -92,6 +92,11 @@ export class InraidCallbacks
|
||||
return this.httpResponse.noBody(this.inraidController.getBTRConfig());
|
||||
}
|
||||
|
||||
public getPostRaidFenceRepDifference(sessionId: string): number
|
||||
{
|
||||
return this.httpResponse.noBody(this.inraidController.getPostRaidFenceRepDifference(sessionId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle singleplayer/traderServices/getTraderServices
|
||||
*/
|
||||
|
@ -586,8 +586,8 @@ export class InraidController
|
||||
{
|
||||
const fenceId = Traders.FENCE;
|
||||
|
||||
let fenceStanding = Number(pmcData.TradersInfo[fenceId].standing);
|
||||
fenceStanding = this.inRaidHelper.calculateFenceStandingChangeFromKillsAsScav(
|
||||
const fenceStanding = Number(pmcData.TradersInfo[fenceId].standing);
|
||||
let adjustedFenceStanding = this.inRaidHelper.calculateFenceStandingChangeFromKillsAsScav(
|
||||
fenceStanding,
|
||||
offraidData.profile.Stats.Eft.Victims,
|
||||
);
|
||||
@ -595,11 +595,14 @@ export class InraidController
|
||||
// Successful extract with scav adds 0.01 standing
|
||||
if (offraidData.exit === PlayerRaidEndState.SURVIVED)
|
||||
{
|
||||
fenceStanding += this.inRaidConfig.scavExtractGain;
|
||||
adjustedFenceStanding += this.inRaidConfig.scavExtractGain;
|
||||
}
|
||||
|
||||
// Store diff in profile for later retreval by client end-of-raid screen
|
||||
pmcData.Stats.Eft.sptLastRaidFenceRepChange = adjustedFenceStanding - fenceStanding;
|
||||
|
||||
// Make standing changes to pmc profile
|
||||
pmcData.TradersInfo[fenceId].standing = Math.min(Math.max(fenceStanding, -7), 15); // Ensure it stays between -7 and 15
|
||||
pmcData.TradersInfo[fenceId].standing = Math.min(Math.max(adjustedFenceStanding, -7), 15); // Ensure it stays between -7 and 15
|
||||
this.logger.debug(`New fence standing: ${pmcData.TradersInfo[fenceId].standing}`);
|
||||
this.traderHelper.lvlUp(fenceId, pmcData);
|
||||
pmcData.TradersInfo[fenceId].loyaltyLevel = Math.max(pmcData.TradersInfo[fenceId].loyaltyLevel, 1);
|
||||
@ -632,6 +635,21 @@ export class InraidController
|
||||
return this.btrConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the rep diff stored post-raid
|
||||
* @param sessionId Player id
|
||||
* @returns Fence rep difference
|
||||
*/
|
||||
public getPostRaidFenceRepDifference(sessionId: string): number
|
||||
{
|
||||
const profile = this.profileHelper.getPmcProfile(sessionId);
|
||||
const valueToReturn = profile.Stats?.Eft?.sptLastRaidFenceRepChange ?? 0;
|
||||
|
||||
delete profile.Stats?.Eft?.sptLastRaidFenceRepChange;
|
||||
|
||||
return valueToReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle singleplayer/traderServices/getTraderServices
|
||||
* @returns Trader services data
|
||||
|
@ -223,6 +223,7 @@ export interface IEftStats
|
||||
LastPlayerState?: LastPlayerState;
|
||||
TotalInGameTime: number;
|
||||
SurvivorClass?: string;
|
||||
sptLastRaidFenceRepChange?: number;
|
||||
}
|
||||
|
||||
export interface IDroppedItem
|
||||
|
@ -48,6 +48,13 @@ export class InraidStaticRouter extends StaticRouter
|
||||
return this.inraidCallbacks.getBTRConfig();
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/getfencerepdiff",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
{
|
||||
return this.inraidCallbacks.getPostRaidFenceRepDifference(sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/traderServices/itemDelivery",
|
||||
(url: string, info: any, sessionID: string, output: string): any =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user