Cleanup of survival state code

Moved hard coded fence rep values into trader config
Improved outcome debug logging
This commit is contained in:
Dev 2024-11-16 20:22:24 +00:00
parent d8be5f71a6
commit d6a5c25b20
5 changed files with 21 additions and 17 deletions

View File

@ -448,7 +448,9 @@
"allowBossItems": false, "allowBossItems": false,
"useRewarditemBlacklist": true "useRewarditemBlacklist": true
}, },
"btrDeliveryExpireHours": 240 "btrDeliveryExpireHours": 240,
"playerRepMin": -7,
"playerRepMax": 15
}, },
"moddedTraders": { "moddedTraders": {
"clothingService": [] "clothingService": []

View File

@ -16,7 +16,7 @@ export interface IEndLocalRaidRequestData {
export interface IEndRaidResult { export interface IEndRaidResult {
profile: IPmcData; profile: IPmcData;
/** "Survived/Transit" etc */ /** "Survived/Transit" etc */
result: string; result: ExitStatus;
killerId: string; killerId: string;
killerAid: string; killerAid: string;
/** "Gate 3" etc */ /** "Gate 3" etc */

View File

@ -1,7 +1,8 @@
export enum ExitStatus { export enum ExitStatus {
SURVIVED = 0, SURVIVED = "Survived",
KILLED = 1, KILLED = "Killed",
LEFT = 2, LEFT = "Left",
RUNNER = 3, RUNNER = "Runner",
MISSINGINACTION = 4, MISSINGINACTION = "MissingInAction",
TRANSIT = "Transit",
} }

View File

@ -50,6 +50,10 @@ export interface IFenceConfig {
blacklist: string[]; blacklist: string[];
coopExtractGift: ICoopExtractReward; coopExtractGift: ICoopExtractReward;
btrDeliveryExpireHours: number; 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 { export interface IItemDurabilityCurrentMax {

View File

@ -334,7 +334,7 @@ export class LocationLifecycleService {
// Quest status? // Quest status?
// stats/eft/aggressor - weird values (EFT.IProfileDataContainer.Nickname) // 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 // Reset flea interval time to out-of-raid value
this.ragfairConfig.runIntervalSeconds = this.ragfairConfig.runIntervalValues.outOfRaid; this.ragfairConfig.runIntervalSeconds = this.ragfairConfig.runIntervalValues.outOfRaid;
@ -579,16 +579,13 @@ export class LocationLifecycleService {
this.applyTraderStandingAdjustments(scavProfile.TradersInfo, request.results.profile.TradersInfo); this.applyTraderStandingAdjustments(scavProfile.TradersInfo, request.results.profile.TradersInfo);
// Clamp fence standing within -7 to 15 range // Clamp fence standing within -7 to 15 range
const fenceMax = 15; const fenceMax = this.traderConfig.fence.playerRepMax; // 15
const fenceMin = -7; const fenceMin = this.traderConfig.fence.playerRepMin; //-7
const currentFenceStanding = request.results.profile.TradersInfo[Traders.FENCE].standing; const currentFenceStanding = request.results.profile.TradersInfo[Traders.FENCE].standing;
scavProfile.TradersInfo[Traders.FENCE].standing = Math.min(Math.max(currentFenceStanding, fenceMin), fenceMax); scavProfile.TradersInfo[Traders.FENCE].standing = Math.min(Math.max(currentFenceStanding, fenceMin), fenceMax);
// Successful extract as scav, give some rep // Successful extract as scav, give some rep
if ( if (this.isPlayerSurvived(request.results) && scavProfile.TradersInfo[Traders.FENCE].standing < fenceMax) {
request.results.result.toLowerCase() === "survived" &&
scavProfile.TradersInfo[Traders.FENCE].standing < fenceMax
) {
scavProfile.TradersInfo[Traders.FENCE].standing += this.inRaidConfig.scavExtractStandingGain; scavProfile.TradersInfo[Traders.FENCE].standing += this.inRaidConfig.scavExtractStandingGain;
} }
@ -952,7 +949,7 @@ export class LocationLifecycleService {
* @returns true if Survived * @returns true if Survived
*/ */
protected isPlayerSurvived(results: IEndRaidResult): boolean { 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 * @returns true if dead
*/ */
protected isPlayerDead(results: IEndRaidResult): boolean { 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 * @returns True if players transfered
*/ */
protected isMapToMapTransfer(results: IEndRaidResult) { protected isMapToMapTransfer(results: IEndRaidResult) {
return results.result.toLowerCase() === "transit"; return results.result === ExitStatus.TRANSIT;
} }
/** /**