From 12c269fb57cd22cf4a32940eccbec0cf3bd7c3e9 Mon Sep 17 00:00:00 2001 From: chomp Date: Wed, 15 Mar 2023 13:28:51 +0000 Subject: [PATCH] Feature: add `adjustPriceWhenBelowHandbookPrice` to ragfair.json + Add comments to ragfair config (!69) Co-authored-by: Dev Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/69 --- project/assets/configs/ragfair.json | 1 + .../src/models/spt/config/IRagfairConfig.ts | 46 +++++++++++++++++-- project/src/services/RagfairPriceService.ts | 6 ++- 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/project/assets/configs/ragfair.json b/project/assets/configs/ragfair.json index 00dc49c5..ad5d9201 100644 --- a/project/assets/configs/ragfair.json +++ b/project/assets/configs/ragfair.json @@ -48,6 +48,7 @@ ] }, "offerAdjustment":{ + "adjustPriceWhenBelowHandbookPrice": true, "maxPriceDifferenceBelowHandbookPercent": 64, "handbookPriceMultipier": 1.1, "priceThreshholdRub": 20000 diff --git a/project/src/models/spt/config/IRagfairConfig.ts b/project/src/models/spt/config/IRagfairConfig.ts index 91eb5391..b49d21e0 100644 --- a/project/src/models/spt/config/IRagfairConfig.ts +++ b/project/src/models/spt/config/IRagfairConfig.ts @@ -4,18 +4,26 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair" + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number + /** Player listing settings */ sell: Sell + /** Trader ids + should their assorts be listed on flea*/ traders: Record dynamic: Dynamic } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean + /** Settings to control chances of offer being sold */ chance: Chance + /** Settings to control how long it takes for a player offer to sell */ time: Time + /** Player offer reputation gain/loss settings */ reputation: Reputation + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number } @@ -42,47 +50,76 @@ export interface Reputation export interface Dynamic { + // Should a purchased dynamic offers items be flagged as found in raid purchasesAreFoundInRaid: boolean /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number + /** How many offers should be listed */ offerItemCount: MinMax + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean endTimeSeconds: MinMax + /** Settings to control the durability range of item items listed on flea */ condition: Condition + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax + /** Range of rating offers for items being listed */ rating: MinMax + /** Percentages to sell offers in each currency */ currencies: Record + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[] + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean + /** Flea blacklist settings */ blacklist: Blacklist } export interface Barter { + /** Should barter offers be generated */ enable: boolean + /** Percentage change an offer is listed as a barter */ chancePercent: number + /** Min number of required items for a barter requirement */ itemCountMin: number + /** Max number of required items for a barter requirement */ itemCountMax: number + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[] } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number min: number max: number @@ -90,12 +127,13 @@ export interface Condition export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean + /** Custom blacklist for item Tpls */ custom: string[] + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean + /** Should quest items be blacklisted from flea */ enableQuestList: boolean + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean } \ No newline at end of file diff --git a/project/src/services/RagfairPriceService.ts b/project/src/services/RagfairPriceService.ts index d34cf60f..50dd7eec 100644 --- a/project/src/services/RagfairPriceService.ts +++ b/project/src/services/RagfairPriceService.ts @@ -203,7 +203,11 @@ export class RagfairPriceService implements OnLoad { // Get dynamic price, fallback to handbook price if value of 1 found let itemPrice = this.getFleaPriceForItem(item._tpl); - itemPrice = this.adjustPriceIfBelowHandbook(itemPrice, item._tpl); + + if (this.ragfairConfig.dynamic.offerAdjustment.adjustPriceWhenBelowHandbookPrice) + { + itemPrice = this.adjustPriceIfBelowHandbook(itemPrice, item._tpl); + } if (this.ragfairConfig.dynamic.useTraderPriceForOffersIfHigher) {