Rework high flea listing price adjuster to be configurable, more item types can be added (!111)

Co-authored-by: Dev <dev@dev.sp-tarkov.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/111
This commit is contained in:
chomp 2023-08-06 11:36:07 +00:00
parent a962823192
commit 6a864bffa9
4 changed files with 70 additions and 55 deletions

View File

@ -1,7 +1,7 @@
{
"runIntervalSeconds": 45,
"sell": {
"simulatedSellHours": 12,
"simulatedSellHours": 12,
"fees": true,
"chance": {
"base": 50,
@ -31,29 +31,29 @@
"ragfair": false
},
"dynamic": {
"purchasesAreFoundInRaid": false,
"useTraderPriceForOffersIfHigher": true,
"barter": {
"enable": true,
"chancePercent": 20,
"itemCountMin": 1,
"itemCountMax": 3,
"priceRangeVariancePercent": 15,
"minRoubleCostToBecomeBarter": 20000,
"itemTypeBlacklist": [
"55802f4a4bdc2ddb688b4569",
"55802f3e4bdc2de7118b4584",
"543be5cb4bdc2deb348b4568",
"55818ac54bdc2d5b648b456e",
"5a74651486f7744e73386dd1"
]
},
"offerAdjustment":{
"adjustPriceWhenBelowHandbookPrice": false,
"maxPriceDifferenceBelowHandbookPercent": 64,
"handbookPriceMultipier": 1.1,
"priceThreshholdRub": 20000
},
"purchasesAreFoundInRaid": false,
"useTraderPriceForOffersIfHigher": true,
"barter": {
"enable": true,
"chancePercent": 20,
"itemCountMin": 1,
"itemCountMax": 3,
"priceRangeVariancePercent": 15,
"minRoubleCostToBecomeBarter": 20000,
"itemTypeBlacklist": [
"55802f4a4bdc2ddb688b4569",
"55802f3e4bdc2de7118b4584",
"543be5cb4bdc2deb348b4568",
"55818ac54bdc2d5b648b456e",
"5a74651486f7744e73386dd1"
]
},
"offerAdjustment": {
"adjustPriceWhenBelowHandbookPrice": false,
"maxPriceDifferenceBelowHandbookPercent": 64,
"handbookPriceMultipier": 1.1,
"priceThreshholdRub": 20000
},
"expiredOfferThreshold": 1500,
"offerItemCount": {
"min": 7,
@ -67,7 +67,7 @@
"min": 0.95,
"max": 1.05
},
"showDefaultPresetsOnly": true,
"showDefaultPresetsOnly": true,
"endTimeSeconds": {
"min": 360,
"max": 3600
@ -128,7 +128,7 @@
"min": 0.1,
"max": 0.95
},
"_currencies": "what percentage of the offers are in each currency",
"_currencies": "what percentage of the offers are in each currency",
"currencies": {
"5449016a4bdc2d6f028b456f": 78,
"5696686a4bdc2da3298b456a": 14,
@ -141,20 +141,28 @@
"5448e53e4bdc2d60728b4567",
"5448bf274bdc2dfc2f8b456a",
"543be5e94bdc2df1348b4568",
"5448f39d4bdc2d0a728b4568"
"5448f39d4bdc2d0a728b4568",
"62e910aaf957f2915e0a5e36"
],
"removeSeasonalItemsWhenNotInEvent": true,
"removeSeasonalItemsWhenNotInEvent": true,
"blacklist": {
"damagedAmmoPacks": true,
"damagedAmmoPacks": true,
"custom": [],
"enableBsgList": true,
"enableBsgList": false,
"enableQuestList": true,
"traderItems": false
},
"unreasonableModPrices": {
"enabled": true,
"handbookPriceOverMultiplier": 9,
"newPriceHandbookMultiplier": 9
}
"unreasonableModPrices": {
"5448fe124bdc2da5018b4567": {
"enabled": true,
"handbookPriceOverMultiplier": 9,
"newPriceHandbookMultiplier": 9
},
"57864a66245977548f04a81f": {
"enabled": true,
"handbookPriceOverMultiplier": 11,
"newPriceHandbookMultiplier": 11
}
}
}
}

View File

@ -3917,7 +3917,7 @@
"count": 1,
"endProduct": "62e910aaf957f2915e0a5e36",
"isEncoded": true,
"locked": true,
"locked": false,
"needFuelForAllProductionTime": true,
"productionLimitCount": 0,
"productionTime": 43200,
@ -3938,10 +3938,6 @@
"requiredLevel": 2,
"type": "Area"
},
{
"questId": "625d700cc48e6c62a440fab5",
"type": "QuestComplete"
},
{
"templateId": "590c2d8786f774245b1f03f3",
"type": "Tool"

View File

@ -85,15 +85,8 @@ export interface Dynamic
removeSeasonalItemsWhenNotInEvent: boolean
/** Flea blacklist settings */
blacklist: Blacklist
/** Should prices over the multiplier be adjusted */
unreasonableModPrices: IUnreasonableModPrices
}
export interface IUnreasonableModPrices
{
enabled: boolean
handbookPriceOverMultiplier: number
newPriceHandbookMultiplier: number
/** Dict of price limits keyed by item type */
unreasonableModPrices: Record<string, IUnreasonableModPrices>
}
export interface Barter
@ -145,4 +138,11 @@ export interface Blacklist
/** Should trader items that are blacklisted by bsg */
traderItems: boolean
}
export interface IUnreasonableModPrices
{
enabled: boolean
handbookPriceOverMultiplier: number
newPriceHandbookMultiplier: number
}

View File

@ -11,7 +11,6 @@ import {
} from "../models/eft/common/tables/IRepeatableQuests";
import { StageBonus } from "../models/eft/hideout/IHideoutArea";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { BaseClasses } from "../models/enums/BaseClasses";
import { ConfigTypes } from "../models/enums/ConfigTypes";
import { HideoutAreas } from "../models/enums/HideoutAreas";
import { QuestStatus } from "../models/enums/QuestStatus";
@ -102,7 +101,7 @@ export class ProfileFixerService
this.updateProfilePocketsToNewId(pmcProfile);
this.updateProfileQuestDataValues(pmcProfile);
if (this.ragfairConfig.dynamic.unreasonableModPrices.enabled)
if (Object.keys(this.ragfairConfig.dynamic.unreasonableModPrices).length > 0)
{
this.adjustUnreasonableModFleaPrices();
}
@ -113,17 +112,29 @@ export class ProfileFixerService
const db = this.databaseServer.getTables();
const fleaPrices = db.templates.prices;
const handbookPrices = db.templates.handbook.Items;
for (const itemTpl in fleaPrices)
for (const itemTypeKey in this.ragfairConfig.dynamic.unreasonableModPrices)
{
if (this.itemHelper.isOfBaseclass(itemTpl, BaseClasses.MOD))
const details = this.ragfairConfig.dynamic.unreasonableModPrices[itemTypeKey];
if (!details?.enabled)
{
continue;
}
for (const itemTpl in fleaPrices)
{
if (!this.itemHelper.isOfBaseclass(itemTpl, itemTypeKey))
{
continue;
}
const itemHandbookPrice = handbookPrices.find(x => x.Id === itemTpl);
if (!itemHandbookPrice)
{
continue;
}
if (fleaPrices[itemTpl] > (itemHandbookPrice.Price * this.ragfairConfig.dynamic.unreasonableModPrices.handbookPriceOverMultiplier))
if (fleaPrices[itemTpl] > (itemHandbookPrice.Price * details.handbookPriceOverMultiplier))
{
if (fleaPrices[itemTpl] <= 1)
{
@ -131,7 +142,7 @@ export class ProfileFixerService
}
// Price is over limit, adjust
fleaPrices[itemTpl] = itemHandbookPrice.Price * this.ragfairConfig.dynamic.unreasonableModPrices.newPriceHandbookMultiplier;
fleaPrices[itemTpl] = itemHandbookPrice.Price * details.newPriceHandbookMultiplier;
}
}
}