Add fence rep gain on taking COOP extract
Refactored fence rep handling code for Car extracts
This commit is contained in:
parent
467c87b026
commit
925d9b3f07
@ -24,9 +24,10 @@
|
||||
"tunnel_shared",
|
||||
"EXFIL_ScavCooperation",
|
||||
"Factory Gate",
|
||||
"Exit_E10_coop"
|
||||
"Exit_E10_coop"
|
||||
],
|
||||
"carExtractBaseStandingGain": 0.4,
|
||||
"coopExtractBaseStandingGain": 0.25,
|
||||
"scavExtractGain": 0.01,
|
||||
"keepFiRSecureContainerOnDeath": false
|
||||
}
|
||||
|
@ -198,6 +198,7 @@ export class MatchController
|
||||
|
||||
if (extractName && this.extractWasViaCoop(extractName) && this.traderConfig.fence.coopExtractGift.sendGift)
|
||||
{
|
||||
this.handleCoopExtract(pmcData, extractName);
|
||||
this.sendCoopTakenFenceMessage(sessionId);
|
||||
}
|
||||
}
|
||||
@ -252,6 +253,37 @@ export class MatchController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle when a player extracts using a coop extract - add rep to fence
|
||||
* @param pmcData Profile
|
||||
* @param extractName Name of extract taken
|
||||
*/
|
||||
protected handleCoopExtract(pmcData: IPmcData, extractName: string): void
|
||||
{
|
||||
if (!pmcData.CoopExtractCounts)
|
||||
{
|
||||
pmcData.CoopExtractCounts = {};
|
||||
}
|
||||
|
||||
// Ensure key exists for extract
|
||||
if (!(extractName in pmcData.CoopExtractCounts))
|
||||
{
|
||||
pmcData.CoopExtractCounts[extractName] = 0;
|
||||
}
|
||||
|
||||
// Increment extract count value
|
||||
pmcData.CoopExtractCounts[extractName] += 1;
|
||||
|
||||
// Get new fence standing value
|
||||
const newFenceStanding = this.getFenceStandingAfterExtract(pmcData, this.inraidConfig.coopExtractBaseStandingGain, pmcData.CoopExtractCounts[extractName]);
|
||||
const fenceId: string = Traders.FENCE;
|
||||
pmcData.TradersInfo[fenceId].standing = newFenceStanding;
|
||||
|
||||
// Check if new standing has leveled up trader
|
||||
this.traderHelper.lvlUp(fenceId, pmcData);
|
||||
pmcData.TradersInfo[fenceId].loyaltyLevel = Math.max(pmcData.TradersInfo[fenceId].loyaltyLevel, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Was extract by car
|
||||
* @param extractName name of extract
|
||||
@ -290,9 +322,13 @@ export class MatchController
|
||||
// Increment extract count value
|
||||
pmcData.CarExtractCounts[extractName] += 1;
|
||||
|
||||
// Not exact replica of Live behaviour
|
||||
// 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, pmcData.CarExtractCounts[extractName]);
|
||||
const fenceId: string = Traders.FENCE;
|
||||
this.updateFenceStandingInProfile(pmcData, fenceId, extractName);
|
||||
|
||||
pmcData.TradersInfo[fenceId].standing = newFenceStanding;
|
||||
|
||||
// Check if new standing has leveled up trader
|
||||
this.traderHelper.lvlUp(fenceId, pmcData);
|
||||
pmcData.TradersInfo[fenceId].loyaltyLevel = Math.max(pmcData.TradersInfo[fenceId].loyaltyLevel, 1);
|
||||
|
||||
@ -300,25 +336,25 @@ export class MatchController
|
||||
}
|
||||
|
||||
/**
|
||||
* Update players fence trader standing value in profile
|
||||
* @param pmcData Player profile
|
||||
* @param fenceId Id of fence trader
|
||||
* @param extractName Name of extract used
|
||||
* Get the fence rep gain from using a car or coop extract
|
||||
* @param pmcData Profile
|
||||
* @param baseGain amount gained for the first extract
|
||||
* @param extractCount Number of times extract was taken
|
||||
* @returns Fence standing after taking extract
|
||||
*/
|
||||
protected updateFenceStandingInProfile(pmcData: IPmcData, fenceId: string, extractName: string): void
|
||||
protected getFenceStandingAfterExtract(pmcData: IPmcData, baseGain: number, extractCount: number): number
|
||||
{
|
||||
// Get current standing
|
||||
const fenceId: string = Traders.FENCE;
|
||||
let fenceStanding = Number(pmcData.TradersInfo[fenceId].standing);
|
||||
|
||||
// Not exact replica of Live behaviour
|
||||
// Simplified for now, no real reason to do the whole (unconfirmed) extra 0.01 standing per day regeneration mechanic
|
||||
const baseGain: number = this.inraidConfig.carExtractBaseStandingGain;
|
||||
const extractCount: number = pmcData.CarExtractCounts[extractName];
|
||||
|
||||
// get standing after taking extract x times, x.xx format, gain from extract can be no smaller than 0.01
|
||||
fenceStanding += Math.max(baseGain / extractCount, 0.01);
|
||||
|
||||
// Ensure fence loyalty level is not above/below the range -7 - 15
|
||||
// Ensure fence loyalty level is not above/below the range -7 to 15
|
||||
const newFenceStanding = Math.min(Math.max(fenceStanding, -7), 15);
|
||||
this.logger.debug(`Old vs new fence standing: ${pmcData.TradersInfo[fenceId].standing}, ${newFenceStanding}`);
|
||||
pmcData.TradersInfo[fenceId].standing = newFenceStanding;
|
||||
|
||||
return Number(newFenceStanding.toFixed(2));
|
||||
}
|
||||
}
|
@ -144,6 +144,7 @@ export class ProfileController
|
||||
pmcData.Hideout.Seed = this.timeUtil.getTimestamp() + (8 * 60 * 60 * 24 * 365); // 8 years in future why? who knows, we saw it in live
|
||||
pmcData.RepeatableQuests = [];
|
||||
pmcData.CarExtractCounts = {};
|
||||
pmcData.CoopExtractCounts = {};
|
||||
|
||||
if (!pmcData.UnlockedInfo)
|
||||
{
|
||||
|
@ -31,7 +31,8 @@ export interface IBotBase
|
||||
RepeatableQuests: IPmcDataRepeatableQuest[]
|
||||
Bonuses: Bonus[]
|
||||
Notes: Notes
|
||||
CarExtractCounts: CarExtractCounts
|
||||
CarExtractCounts: Record<string, number>
|
||||
CoopExtractCounts: Record<string, number>
|
||||
SurvivorClass: SurvivorClass
|
||||
WishList: string[]
|
||||
/** SPT specific property used during bot generation in raid */
|
||||
@ -445,11 +446,6 @@ export interface Notes
|
||||
Notes: Note[]
|
||||
}
|
||||
|
||||
export interface CarExtractCounts
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
export enum SurvivorClass
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
|
@ -12,8 +12,10 @@ export interface IInRaidConfig extends IBaseConfig
|
||||
carExtracts: string[]
|
||||
/** Names of coop extracts */
|
||||
coopExtracts: string[]
|
||||
/** Fene rep gain from a single car extract */
|
||||
/** Fence rep gain from a single car extract */
|
||||
carExtractBaseStandingGain: number
|
||||
/** Fence rep gain from a single coop extract */
|
||||
coopExtractBaseStandingGain: number
|
||||
/** Fence rep gain when successfully extracting as pscav */
|
||||
scavExtractGain: number
|
||||
/** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */
|
||||
|
Loading…
Reference in New Issue
Block a user