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());
|
return this.httpResponse.noBody(this.inraidController.getBTRConfig());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getPostRaidFenceRepDifference(sessionId: string): number
|
||||||
|
{
|
||||||
|
return this.httpResponse.noBody(this.inraidController.getPostRaidFenceRepDifference(sessionId));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle singleplayer/traderServices/getTraderServices
|
* Handle singleplayer/traderServices/getTraderServices
|
||||||
*/
|
*/
|
||||||
|
@ -586,8 +586,8 @@ export class InraidController
|
|||||||
{
|
{
|
||||||
const fenceId = Traders.FENCE;
|
const fenceId = Traders.FENCE;
|
||||||
|
|
||||||
let fenceStanding = Number(pmcData.TradersInfo[fenceId].standing);
|
const fenceStanding = Number(pmcData.TradersInfo[fenceId].standing);
|
||||||
fenceStanding = this.inRaidHelper.calculateFenceStandingChangeFromKillsAsScav(
|
let adjustedFenceStanding = this.inRaidHelper.calculateFenceStandingChangeFromKillsAsScav(
|
||||||
fenceStanding,
|
fenceStanding,
|
||||||
offraidData.profile.Stats.Eft.Victims,
|
offraidData.profile.Stats.Eft.Victims,
|
||||||
);
|
);
|
||||||
@ -595,11 +595,14 @@ export class InraidController
|
|||||||
// Successful extract with scav adds 0.01 standing
|
// Successful extract with scav adds 0.01 standing
|
||||||
if (offraidData.exit === PlayerRaidEndState.SURVIVED)
|
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
|
// 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.logger.debug(`New fence standing: ${pmcData.TradersInfo[fenceId].standing}`);
|
||||||
this.traderHelper.lvlUp(fenceId, pmcData);
|
this.traderHelper.lvlUp(fenceId, pmcData);
|
||||||
pmcData.TradersInfo[fenceId].loyaltyLevel = Math.max(pmcData.TradersInfo[fenceId].loyaltyLevel, 1);
|
pmcData.TradersInfo[fenceId].loyaltyLevel = Math.max(pmcData.TradersInfo[fenceId].loyaltyLevel, 1);
|
||||||
@ -632,6 +635,21 @@ export class InraidController
|
|||||||
return this.btrConfig;
|
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
|
* Handle singleplayer/traderServices/getTraderServices
|
||||||
* @returns Trader services data
|
* @returns Trader services data
|
||||||
|
@ -223,6 +223,7 @@ export interface IEftStats
|
|||||||
LastPlayerState?: LastPlayerState;
|
LastPlayerState?: LastPlayerState;
|
||||||
TotalInGameTime: number;
|
TotalInGameTime: number;
|
||||||
SurvivorClass?: string;
|
SurvivorClass?: string;
|
||||||
|
sptLastRaidFenceRepChange?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDroppedItem
|
export interface IDroppedItem
|
||||||
|
@ -48,6 +48,13 @@ export class InraidStaticRouter extends StaticRouter
|
|||||||
return this.inraidCallbacks.getBTRConfig();
|
return this.inraidCallbacks.getBTRConfig();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
new RouteAction(
|
||||||
|
"/singleplayer/getfencerepdiff",
|
||||||
|
(url: string, info: any, sessionID: string, output: string): any =>
|
||||||
|
{
|
||||||
|
return this.inraidCallbacks.getPostRaidFenceRepDifference(sessionID);
|
||||||
|
},
|
||||||
|
),
|
||||||
new RouteAction(
|
new RouteAction(
|
||||||
"/singleplayer/traderServices/itemDelivery",
|
"/singleplayer/traderServices/itemDelivery",
|
||||||
(url: string, info: any, sessionID: string, output: string): any =>
|
(url: string, info: any, sessionID: string, output: string): any =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user