Feature: add adjustPriceWhenBelowHandbookPrice to ragfair.json + Add comments to ragfair config (!69)

Co-authored-by: Dev <dev@noreply.dev.sp-tarkov.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/69
This commit is contained in:
chomp 2023-03-15 13:28:51 +00:00
parent f74031b4d5
commit 12c269fb57
3 changed files with 48 additions and 5 deletions

View File

@ -48,6 +48,7 @@
]
},
"offerAdjustment":{
"adjustPriceWhenBelowHandbookPrice": true,
"maxPriceDifferenceBelowHandbookPercent": 64,
"handbookPriceMultipier": 1.1,
"priceThreshholdRub": 20000

View File

@ -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<string,boolean>
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<string, number>
/** 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
}

View File

@ -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)
{