Add configurable craft time of cultist circle

This commit is contained in:
Dev 2024-09-13 10:38:55 +01:00
parent a5679140aa
commit d18ef883da
3 changed files with 49 additions and 1 deletions

View File

@ -16,6 +16,18 @@
"min": 0.7,
"max": 1.4
},
"craftTimeThreshholds": [
{
"min": 1,
"max": 25000,
"timeSeconds": 21600
},{
"min": 25001,
"max": 99999999,
"timeSeconds": 43200
}
],
"craftTimeOverride": 40,
"directRewards": {
"66572c82ad599021091c6118": ["5c0e874186f7745dc7616606"],
"66572be36a723f7f005a066e": ["5b3b713c5acfc4330140bd8d"],

View File

@ -122,15 +122,44 @@ export class HideoutHelper {
pmcData: IPmcData,
recipeId: string,
sacrificedItems: Item[],
rewardAmountRoubles: number,
): void {
// TODO: hard coded 5 hour (18000) craft + no fuel use, where can we get this data
const cultistProduction = this.initProduction(recipeId, 30, false, true);
const cultistProduction = this.initProduction(
recipeId,
this.getCircleCraftTime(rewardAmountRoubles),
false,
true,
);
cultistProduction.GivenItemsInStart = sacrificedItems;
// Add circle production to profile
pmcData.Hideout.Production[recipeId] = cultistProduction;
}
/**
* Get the circle craft time as seconds, value is based on reward item value
* @param rewardAmountRoubles Value of rewards in roubles
* @returns craft time seconds
*/
protected getCircleCraftTime(rewardAmountRoubles: number): number {
// Edge case, check if override exists
if (this.hideoutConfig.cultistCircle.craftTimeOverride !== -1) {
return this.hideoutConfig.cultistCircle.craftTimeOverride;
}
const thresholds = this.hideoutConfig.cultistCircle.craftTimeThreshholds;
const matchingThreshold = thresholds.find(
(craftThreshold) => craftThreshold.min <= rewardAmountRoubles && craftThreshold.max >= rewardAmountRoubles,
);
if (!matchingThreshold) {
// No craft time found, default to 12 hours
return this.timeUtil.getHoursAsSeconds(12);
}
return matchingThreshold.timeSeconds;
}
/**
* This convenience function initializes new Production Object
* with all the constants.

View File

@ -20,6 +20,9 @@ export interface ICultistCircleSettings {
maxRewardItemCount: number;
maxAttemptsToPickRewardsWithinBudget: number;
rewardPriceMultiplerMinMax: MinMax;
craftTimeThreshholds: CraftTimeThreshhold[];
/** -1 means no override */
craftTimeOverride: number;
/** Specific reward pool when player sacrificed one specific item */
directRewards: Record<string, string[]>;
directRewardStackSize: Record<string, MinMax>;
@ -29,3 +32,7 @@ export interface ICultistCircleSettings {
additionalRewardItemPool: string[];
currencyRewards: Record<string, MinMax>;
}
export interface CraftTimeThreshhold extends MinMax {
timeSeconds: number;
}