This commit is contained in:
Dev 2024-01-21 17:54:09 +00:00
commit 5b296975e8
6 changed files with 42 additions and 12 deletions

View File

@ -35,5 +35,6 @@
"carExtractBaseStandingGain": 0.4,
"coopExtractBaseStandingGain": 0.25,
"scavExtractGain": 0.01,
"pmcKillProbabilityForScavGain": 0.2,
"keepFiRSecureContainerOnDeath": false
}

View File

@ -46,7 +46,7 @@ export class InraidController
{
protected airdropConfig: IAirdropConfig;
protected btrConfig: IBTRConfig;
protected inraidConfig: IInRaidConfig;
protected inRaidConfig: IInRaidConfig;
protected traderConfig: ITraderConfig;
constructor(
@ -74,7 +74,7 @@ export class InraidController
{
this.airdropConfig = this.configServer.getConfig(ConfigTypes.AIRDROP);
this.btrConfig = this.configServer.getConfig(ConfigTypes.BTR);
this.inraidConfig = this.configServer.getConfig(ConfigTypes.IN_RAID);
this.inRaidConfig = this.configServer.getConfig(ConfigTypes.IN_RAID);
this.traderConfig = this.configServer.getConfig(ConfigTypes.TRADER);
}
@ -100,7 +100,7 @@ export class InraidController
{
this.logger.debug(`Raid outcome: ${offraidData.exit}`);
if (!this.inraidConfig.save.loot)
if (!this.inRaidConfig.save.loot)
{
return;
}
@ -486,7 +486,7 @@ export class InraidController
// Successful extract with scav adds 0.01 standing
if (offraidData.exit === PlayerRaidEndState.SURVIVED)
{
fenceStanding += this.inraidConfig.scavExtractGain;
fenceStanding += this.inRaidConfig.scavExtractGain;
}
// Make standing changes to pmc profile
@ -502,7 +502,7 @@ export class InraidController
*/
public getInraidConfig(): IInRaidConfig
{
return this.inraidConfig;
return this.inRaidConfig;
}
/**

View File

@ -38,7 +38,7 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export class MatchController
{
protected matchConfig: IMatchConfig;
protected inraidConfig: IInRaidConfig;
protected inRaidConfig: IInRaidConfig;
protected traderConfig: ITraderConfig;
protected pmcConfig: IPmcConfig;
@ -61,7 +61,7 @@ export class MatchController
)
{
this.matchConfig = this.configServer.getConfig(ConfigTypes.MATCH);
this.inraidConfig = this.configServer.getConfig(ConfigTypes.IN_RAID);
this.inRaidConfig = this.configServer.getConfig(ConfigTypes.IN_RAID);
this.traderConfig = this.configServer.getConfig(ConfigTypes.TRADER);
this.pmcConfig = this.configServer.getConfig(ConfigTypes.PMC);
}
@ -213,7 +213,7 @@ export class MatchController
return false;
}
return (this.inraidConfig.coopExtracts.includes(extractName.trim()));
return (this.inRaidConfig.coopExtracts.includes(extractName.trim()));
}
protected sendCoopTakenFenceMessage(sessionId: string): void
@ -269,7 +269,7 @@ export class MatchController
// Get new fence standing value
const newFenceStanding = this.getFenceStandingAfterExtract(
pmcData,
this.inraidConfig.coopExtractBaseStandingGain,
this.inRaidConfig.coopExtractBaseStandingGain,
pmcData.CoopExtractCounts[extractName],
);
const fenceId: string = Traders.FENCE;
@ -298,7 +298,7 @@ export class MatchController
return true;
}
return this.inraidConfig.carExtracts.includes(extractName.trim());
return this.inRaidConfig.carExtracts.includes(extractName.trim());
}
/**
@ -322,7 +322,7 @@ export class MatchController
// Simplified for now, no real reason to do the whole (unconfirmed) extra 0.01 standing per day regeneration mechanic
const newFenceStanding = this.getFenceStandingAfterExtract(
pmcData,
this.inraidConfig.carExtractBaseStandingGain,
this.inRaidConfig.carExtractBaseStandingGain,
pmcData.CarExtractCounts[extractName],
);
const fenceId: string = Traders.FENCE;

View File

@ -22,6 +22,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
import { ProfileHelper } from "./ProfileHelper";
@injectable()
@ -44,6 +45,7 @@ export class InRaidHelper
@inject("LocalisationService") protected localisationService: LocalisationService,
@inject("ProfileFixerService") protected profileFixerService: ProfileFixerService,
@inject("ConfigServer") protected configServer: ConfigServer,
@inject("RandomUtil") protected randomUtil: RandomUtil
)
{
this.lostOnDeathConfig = this.configServer.getConfig(ConfigTypes.LOST_ON_DEATH);
@ -124,7 +126,15 @@ export class InRaidHelper
}
// PMCs - get by bear/usec
return botTypes[victim.Side.toLowerCase()]?.experience?.standingForKill;
let pmcStandingForKill = botTypes[victim.Side.toLowerCase()]?.experience?.standingForKill;
const pmcKillProbabilityForScavGain = this.inRaidConfig.pmcKillProbabilityForScavGain;
if(this.randomUtil.rollForChanceProbability(pmcKillProbabilityForScavGain))
{
pmcStandingForKill += this.inRaidConfig.scavExtractGain
}
return pmcStandingForKill;
}
/**

View File

@ -18,6 +18,8 @@ export interface IInRaidConfig extends IBaseConfig
coopExtractBaseStandingGain: number;
/** Fence rep gain when successfully extracting as pscav */
scavExtractGain: number;
/** The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. */
pmcKillProbabilityForScavGain: number;
/** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */
keepFiRSecureContainerOnDeath: boolean;
}

View File

@ -472,4 +472,21 @@ export class RandomUtil
return array;
}
/**
* Rolls for a probability based on chance
* @param number Probability Chance as float (0-1)
* @returns If roll succeed or not
* @example
* rollForChanceProbability(0.25); // returns true 25% probability
*/
public rollForChanceProbability(probabilityChance: number): boolean
{
const maxRoll = 9999;
// Roll a number between 0 and 1
const rolledChance = this.getInt(0, maxRoll) / 10000;
return rolledChance <= probabilityChance;
}
}