Add scarce offers feature

This commit is contained in:
Platinum 2024-02-08 19:52:15 +11:00
parent 9ea926cd7c
commit a1a4388f9c
3 changed files with 35 additions and 1 deletions

View File

@ -26,5 +26,23 @@
"handbookPriceMultiplier": 3, "handbookPriceMultiplier": 3,
// Overrides ragfairConfig.runIntervalSeconds if config.enableFasterSales is true. Default 3s. // Overrides ragfairConfig.runIntervalSeconds if config.enableFasterSales is true. Default 3s.
"runIntervalSecondsOverride": 3 "runIntervalSecondsOverride": 3,
// When config.enableScarceOffers is true, use these values to limit the number of offers on the flea.
"offerItemCountOverride": {
"max": 3,
"min": 1
},
// When config.enableScarceOffers is true, use these values to limit the quantity of a stackable item (like ammo) per offer on the flea.
"stackablePercentOverride": {
"max": 200,
"min": 20
},
// When config.enableScarceOffers is true, use these values to limit the quantity of a non-stackable item (most items) per offer on the flea.
"nonStackableCountOverride": {
"max": 3,
"min": 1
}
} }

View File

@ -5,6 +5,9 @@
// Make cheap offers sell faster. Default true. // Make cheap offers sell faster. Default true.
"enableFasterSales": true, "enableFasterSales": true,
// Reduces the number of offers and quantities per offer to make the flea experience more hardcore. Highly recommend to enable but default is false.
"enableScarceOffers": true,
// Limits the flea price of many attachments as these prices can be inflated heavily by Gunsmith tasks in Live Tarkov. Default true. // Limits the flea price of many attachments as these prices can be inflated heavily by Gunsmith tasks in Live Tarkov. Default true.
"limitMaxPriceOfAttachments": true, "limitMaxPriceOfAttachments": true,

View File

@ -137,6 +137,19 @@ class TheBlacklistMod implements IPostDBLoadModAsync {
if (this.config.enableFasterSales && !isNaN(this.advancedConfig.runIntervalSecondsOverride)) { if (this.config.enableFasterSales && !isNaN(this.advancedConfig.runIntervalSecondsOverride)) {
ragfairConfig.runIntervalSeconds = this.advancedConfig.runIntervalSecondsOverride; ragfairConfig.runIntervalSeconds = this.advancedConfig.runIntervalSecondsOverride;
} }
if (this.config.enableScarceOffers) {
this.updateRagfairConfigToHaveScarceOffers(ragfairConfig);
}
}
private updateRagfairConfigToHaveScarceOffers(ragfairConfig: IRagfairConfig) {
const minMaxPropertiesToOverride = ["offerItemCount", "stackablePercent", "nonStackableCount"];
for (const propertyToOverride of minMaxPropertiesToOverride) {
ragfairConfig.dynamic[propertyToOverride].max = this.advancedConfig[`${propertyToOverride}Override`].max;
ragfairConfig.dynamic[propertyToOverride].min = this.advancedConfig[`${propertyToOverride}Override`].min;
}
} }
// Returns true if we updated something using the customItemConfig so we can skip to the next handbook item. // Returns true if we updated something using the customItemConfig so we can skip to the next handbook item.