diff --git a/project/assets/configs/trader.json b/project/assets/configs/trader.json index fd552dcc..f35f2a28 100644 --- a/project/assets/configs/trader.json +++ b/project/assets/configs/trader.json @@ -448,7 +448,9 @@ "allowBossItems": false, "useRewarditemBlacklist": true }, - "btrDeliveryExpireHours": 240 + "btrDeliveryExpireHours": 240, + "playerRepMin": -7, + "playerRepMax": 15 }, "moddedTraders": { "clothingService": [] diff --git a/project/src/models/eft/match/IEndLocalRaidRequestData.ts b/project/src/models/eft/match/IEndLocalRaidRequestData.ts index 81f657e2..34010e1a 100644 --- a/project/src/models/eft/match/IEndLocalRaidRequestData.ts +++ b/project/src/models/eft/match/IEndLocalRaidRequestData.ts @@ -16,7 +16,7 @@ export interface IEndLocalRaidRequestData { export interface IEndRaidResult { profile: IPmcData; /** "Survived/Transit" etc */ - result: string; + result: ExitStatus; killerId: string; killerAid: string; /** "Gate 3" etc */ diff --git a/project/src/models/enums/ExitStatis.ts b/project/src/models/enums/ExitStatis.ts index fd020762..2a006d05 100644 --- a/project/src/models/enums/ExitStatis.ts +++ b/project/src/models/enums/ExitStatis.ts @@ -1,7 +1,8 @@ export enum ExitStatus { - SURVIVED = 0, - KILLED = 1, - LEFT = 2, - RUNNER = 3, - MISSINGINACTION = 4, + SURVIVED = "Survived", + KILLED = "Killed", + LEFT = "Left", + RUNNER = "Runner", + MISSINGINACTION = "MissingInAction", + TRANSIT = "Transit", } diff --git a/project/src/models/spt/config/ITraderConfig.ts b/project/src/models/spt/config/ITraderConfig.ts index f74b40e9..b17ecb39 100644 --- a/project/src/models/spt/config/ITraderConfig.ts +++ b/project/src/models/spt/config/ITraderConfig.ts @@ -50,6 +50,10 @@ export interface IFenceConfig { blacklist: string[]; coopExtractGift: ICoopExtractReward; btrDeliveryExpireHours: number; + /** Smallest value player rep with fence can fall to */ + playerRepMin: number; + /** Highest value player rep with fence can climb to */ + playerRepMax: number; } export interface IItemDurabilityCurrentMax { diff --git a/project/src/services/LocationLifecycleService.ts b/project/src/services/LocationLifecycleService.ts index cd08bd2e..1d5ce6f1 100644 --- a/project/src/services/LocationLifecycleService.ts +++ b/project/src/services/LocationLifecycleService.ts @@ -334,7 +334,7 @@ export class LocationLifecycleService { // Quest status? // stats/eft/aggressor - weird values (EFT.IProfileDataContainer.Nickname) - this.logger.debug(`Raid outcome: ${request.results.result}`); + this.logger.debug(`Raid: ${request.serverId} outcome: ${request.results.result}`); // Reset flea interval time to out-of-raid value this.ragfairConfig.runIntervalSeconds = this.ragfairConfig.runIntervalValues.outOfRaid; @@ -579,16 +579,13 @@ export class LocationLifecycleService { this.applyTraderStandingAdjustments(scavProfile.TradersInfo, request.results.profile.TradersInfo); // Clamp fence standing within -7 to 15 range - const fenceMax = 15; - const fenceMin = -7; + const fenceMax = this.traderConfig.fence.playerRepMax; // 15 + const fenceMin = this.traderConfig.fence.playerRepMin; //-7 const currentFenceStanding = request.results.profile.TradersInfo[Traders.FENCE].standing; scavProfile.TradersInfo[Traders.FENCE].standing = Math.min(Math.max(currentFenceStanding, fenceMin), fenceMax); // Successful extract as scav, give some rep - if ( - request.results.result.toLowerCase() === "survived" && - scavProfile.TradersInfo[Traders.FENCE].standing < fenceMax - ) { + if (this.isPlayerSurvived(request.results) && scavProfile.TradersInfo[Traders.FENCE].standing < fenceMax) { scavProfile.TradersInfo[Traders.FENCE].standing += this.inRaidConfig.scavExtractStandingGain; } @@ -952,7 +949,7 @@ export class LocationLifecycleService { * @returns true if Survived */ protected isPlayerSurvived(results: IEndRaidResult): boolean { - return results.result.toLowerCase() === "survived"; + return results.result === ExitStatus.SURVIVED; } /** @@ -961,7 +958,7 @@ export class LocationLifecycleService { * @returns true if dead */ protected isPlayerDead(results: IEndRaidResult): boolean { - return ["killed", "missinginaction", "left"].includes(results.result.toLowerCase()); + return [ExitStatus.KILLED, ExitStatus.MISSINGINACTION, ExitStatus.LEFT].includes(results.result); } /** @@ -970,7 +967,7 @@ export class LocationLifecycleService { * @returns True if players transfered */ protected isMapToMapTransfer(results: IEndRaidResult) { - return results.result.toLowerCase() === "transit"; + return results.result === ExitStatus.TRANSIT; } /**