diff --git a/project/src/callbacks/InraidCallbacks.ts b/project/src/callbacks/InraidCallbacks.ts index 005284c5..628ddabf 100644 --- a/project/src/callbacks/InraidCallbacks.ts +++ b/project/src/callbacks/InraidCallbacks.ts @@ -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 */ diff --git a/project/src/controllers/InraidController.ts b/project/src/controllers/InraidController.ts index b8186343..a9dc6284 100644 --- a/project/src/controllers/InraidController.ts +++ b/project/src/controllers/InraidController.ts @@ -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 diff --git a/project/src/models/eft/common/tables/IBotBase.ts b/project/src/models/eft/common/tables/IBotBase.ts index af7b6665..cccd2678 100644 --- a/project/src/models/eft/common/tables/IBotBase.ts +++ b/project/src/models/eft/common/tables/IBotBase.ts @@ -223,6 +223,7 @@ export interface IEftStats LastPlayerState?: LastPlayerState; TotalInGameTime: number; SurvivorClass?: string; + sptLastRaidFenceRepChange?: number; } export interface IDroppedItem diff --git a/project/src/routers/static/InraidStaticRouter.ts b/project/src/routers/static/InraidStaticRouter.ts index f2835755..69029649 100644 --- a/project/src/routers/static/InraidStaticRouter.ts +++ b/project/src/routers/static/InraidStaticRouter.ts @@ -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 =>